diff --git a/Web/Attributes/ActionLogAttribute.cs b/Web/Attributes/ActionLogAttribute.cs index 7918a6a..020901f 100644 --- a/Web/Attributes/ActionLogAttribute.cs +++ b/Web/Attributes/ActionLogAttribute.cs @@ -13,12 +13,12 @@ namespace MileageTraker.Web.Attributes var action = filterContext.RouteData.Values["action"].ToString(); var username = filterContext.HttpContext.User.Identity.Name; var loggerName = string.Format("{0}Controller.{1}", controller, action); - var @params = string.Join(", ", filterContext.ActionParameters.Select(i => i.Key + ": " + i.Value)); + var @params = string.Join(", ", filterContext.ActionParameters.Select(i => i.Key + ": {" + i.Value +"}")); - var hostAddress = "UserHostAddress: " + filterContext.HttpContext.Request.UserHostAddress; + var hostAddress = filterContext.HttpContext.Request.UserHostAddress; log4net.LogManager.GetLogger(loggerName) - .InfoFormat("{0}, username: {1}, {2}", hostAddress, username, @params); + .InfoFormat("UserHostAddress: {0}, username: {1}, params: {{{2}}}", hostAddress, username, @params); } base.OnActionExecuting(filterContext); } diff --git a/Web/Attributes/LogOwnerAuthorizeAttribute.cs b/Web/Attributes/LogOwnerAuthorizeAttribute.cs index 1a85512..1d10ccb 100644 --- a/Web/Attributes/LogOwnerAuthorizeAttribute.cs +++ b/Web/Attributes/LogOwnerAuthorizeAttribute.cs @@ -1,11 +1,6 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Security; -using System.Web; +using System.Web; using System.Web.Mvc; using MileageTraker.Web.DAL; -using MileageTraker.Web.Models; namespace MileageTraker.Web.Attributes { diff --git a/Web/Models/MileageLogType.cs b/Web/Models/MileageLogType.cs index 904eabb..da4f673 100644 --- a/Web/Models/MileageLogType.cs +++ b/Web/Models/MileageLogType.cs @@ -1,4 +1,5 @@ using System.ComponentModel.DataAnnotations; +using MileageTraker.Web.Utility; namespace MileageTraker.Web.Models { @@ -33,5 +34,10 @@ namespace MileageTraker.Web.Models { return new MileageLogTypeWrapper { Enum = c }; } + + public override string ToString() + { + return Enum.GetDisplayName(); + } } } \ No newline at end of file diff --git a/Web/ViewModels/CreateLog/CreateLogViewModel.cs b/Web/ViewModels/CreateLog/CreateLogViewModel.cs index 9645372..006cfbf 100644 --- a/Web/ViewModels/CreateLog/CreateLogViewModel.cs +++ b/Web/ViewModels/CreateLog/CreateLogViewModel.cs @@ -110,5 +110,12 @@ namespace MileageTraker.Web.ViewModels.CreateLog if (result != null) yield return result; } + + public override string ToString() + { + return string.Format( + "vehicle: {0}, odo: {1}, type: {2}, city: {3}, gas: {4}, purpose: {5}, date: {6}", + VehicleId, EndOdometer, LogType, CityName, GasPurchased, Purpose, Date.ToShortDateString()); + } } } \ No newline at end of file diff --git a/Web/ViewModels/Log/LogViewModel.cs b/Web/ViewModels/Log/LogViewModel.cs index 8542b9e..00c0428 100644 --- a/Web/ViewModels/Log/LogViewModel.cs +++ b/Web/ViewModels/Log/LogViewModel.cs @@ -147,5 +147,12 @@ namespace MileageTraker.Web.ViewModels.Log } } } + + public override string ToString() + { + return string.Format( + "vehicle: {0}, odo: {1}, type: {2}, city: {3}, gas: {4}, purpose: {5}, date: {6}", + VehicleId, EndOdometer, LogType, CityName, GasPurchased, Purpose, Date.ToShortDateString()); + } } } \ No newline at end of file diff --git a/Web/ViewModels/SelectListViewModel.cs b/Web/ViewModels/SelectListViewModel.cs index d720cbf..a6d8ca7 100644 --- a/Web/ViewModels/SelectListViewModel.cs +++ b/Web/ViewModels/SelectListViewModel.cs @@ -6,5 +6,10 @@ namespace MileageTraker.Web.ViewModels { public SelectList Available { get; set; } public int Selected { get; set; } + + public override string ToString() + { + return Selected.ToString(); + } } } \ No newline at end of file