public ActionResult AddEditProgramFormat(long?programFormatTypeId) { var viewModel = new AddEditProgramFormatViewModel(); if (programFormatTypeId.HasValue) { var drProgramFormat = CRCDataAccess.GetProgramFormatType(programFormatTypeId.Value); drProgramFormat.MapTo(viewModel); viewModel.EnabledInd = !(drProgramFormat["DisabledDate"] is DateTime); } return(PartialView(viewModel)); }
public ActionResult AddEditProgramFormat(AddEditProgramFormatViewModel viewModel) { if (ModelState.IsValid) { CRCDataAccess.SaveProgramFormatType( viewModel.ProgramFormatTypeId, viewModel.ProgramFormatTypeName, viewModel.ProgramFormatTypeCode, viewModel.MajorFormatId, viewModel.EnabledInd ? (DateTime?)null : DateTime.UtcNow, viewModel.EnabledInd ? (long?)null : CRCUser.UserId, CRCUser.UserId); return(Json(true)); } else { return(PartialView(viewModel)); } }