Add currency attribute

This commit is contained in:
2015-10-08 14:17:30 -04:00
parent 13fc366dc5
commit 6482955b3c
7 changed files with 79 additions and 4 deletions
@@ -2,6 +2,7 @@
using System.ComponentModel.DataAnnotations;
using System.Web.Mvc;
using AutoMapper;
using MileageTraker.Web.Attributes;
using MileageTraker.Web.ViewModels.Log;
namespace MileageTraker.Web.ViewModels.FuelLog
@@ -44,6 +45,7 @@ namespace MileageTraker.Web.ViewModels.FuelLog
[Required]
[Display(Name = "Total Price")]
[Currency]
public decimal TotalPrice { get; set; }
// Matched log
@@ -36,7 +36,7 @@ namespace MileageTraker.Web.ViewModels.VehicleService
[Required]
[InputSize("small")]
[Units("$")]
[Currency]
public decimal Price { get; set; }
[StringLength(64, MinimumLength = 3, ErrorMessage = "Minimum 3 characters")]
@@ -45,7 +45,8 @@ namespace MileageTraker.Web.ViewModels.VehicleService
static VehicleServiceViewModel()
{
Mapper.CreateMap<VehicleServiceViewModel, Models.VehicleService>();
Mapper.CreateMap<Models.VehicleService, VehicleServiceViewModel>();
Mapper.CreateMap<Models.VehicleService, VehicleServiceViewModel>()
.ForMember(dest => dest.VehicleId, opt => opt.MapFrom(src => src.Vehicle.VehicleId));
}
public VehicleServiceViewModel(Models.VehicleService vehicleService)