public async Task <IActionResult> Edit(int id, [Bind("ID,Name,Description,IsActive,UserCreate,DateCreate,UserUpdate,DateUpdate")] ClientTypeModel clientTypeModel) { if (id != clientTypeModel.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(clientTypeModel); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ClientTypeModelExists(clientTypeModel.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(clientTypeModel)); }
public ActionResult Add(ClientTypeModel model) { if (ModelState.IsValid) { ClientType clientType = model.MapTo <ClientTypeModel, ClientType>(); _clientTypeService.Insert(clientType); return(RedirectToAction("Index")); } return(View(model)); }
public static ClientTypeDto ToDto(this ClientTypeModel clientType) { return(new ClientTypeDto() { ClientTypeId = clientType.ClientTypeId, MinutePrice = clientType.MinutePrice, SMSPrice = clientType.SMSPrice, TypeName = clientType.TypeName, //Clients = clientType.Clients.Select(c => c.ToDto()).ToList() }); }
public ActionResult Edit(ClientTypeModel model) { if (ModelState.IsValid) { ClientType clientType = model.MapTo <ClientTypeModel, ClientType>(); _clientTypeService.Update(clientType); SuccessNotification($"{_localizationService.GetResource("UpdateSuccess") }"); return(RedirectToAction("Index")); } return(View(model)); }
public async Task <IActionResult> Create([Bind("Name,Description")] ClientTypeModel clientTypeModel) { if (ModelState.IsValid) { clientTypeModel.UserCreate = User.Identity.Name; _context.Add(clientTypeModel); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(clientTypeModel)); }
/// <summary> /// To the model. /// </summary> /// <param name="entity">The entity.</param> /// <returns></returns> public static ClientTypeModel ToModel(this ClientTypeViewModel entity) { if (entity == null) { return(null); } var model = new ClientTypeModel { ClientTypeID = entity.ClientTypeID, ClientType = entity.ClientType }; return(model); }
/// <summary> /// To the view model. /// </summary> /// <param name="model">The model.</param> /// <returns></returns> public static ClientTypeViewModel ToViewModel(this ClientTypeModel model) { if (model == null) { return(null); } var entity = new ClientTypeViewModel { ClientTypeID = model.ClientTypeID, ClientType = model.ClientType }; return(entity); }
public static CRMServiceReference.ClientTypeDto ToDto(this ClientTypeModel clientType) { if (clientType == null) { return(null); } return(new CRMServiceReference.ClientTypeDto() { ClientTypeId = clientType.ClientTypeId, MinutePrice = clientType.MinutePrice, SMSPrice = clientType.SMSPrice, TypeName = clientType.TypeName, //Clients = clientType.Clients.Select(c => c.ToDto()).ToList() }); }
public ActionResult Add() { ClientTypeModel model = new ClientTypeModel(); return(View(model)); }