public ActionResult AddEditBand(long?bandId) { var viewModel = new AddEditBandViewModel(); if (bandId.HasValue) { var drBand = CRCDataAccess.GetBand(bandId.Value); drBand.MapTo(viewModel); viewModel.EnabledInd = !(drBand["DisabledDate"] is DateTime); } return(PartialView(viewModel)); }
public ActionResult AddEditBand(AddEditBandViewModel viewModel) { if (ModelState.IsValid) { CRCDataAccess.SaveBand( viewModel.BandId, viewModel.BandName, viewModel.EnabledInd ? (DateTime?)null : DateTime.UtcNow, viewModel.EnabledInd ? (long?)null : CRCUser.UserId, CRCUser.UserId); return(Json(true)); } else { return(PartialView(viewModel)); } }