private Stores Entity(StoresDto storeDto) { return(new Stores() { Address = storeDto.Address, Id = storeDto.Id, Name = storeDto.Name }); }
/// <summary> /// Metodo para eliminar un registro /// </summary> private void Delete() { var storesDto = new StoresDto() { Address = this.txtAddress.Text, Id = int.Parse(this.txtId.Text), Name = this.txtName.Text }; StoresServices storesServices = new StoresServices(); storesServices.Delete(storesDto); LoadGrid(); }
/// <summary> /// Metodo para agregar o actualizar un regitro /// </summary> private void Save() { var storesDto = new StoresDto() { Address = this.txtAddress.Text, Id = string.IsNullOrEmpty(this.txtId.Text) ? 0 : int.Parse(this.txtId.Text), Name = this.txtName.Text }; StoresServices storesServices = new StoresServices(); storesServices.Save(storesDto); LoadGrid(); }
public ActionResult <Response> Del([FromBody] StoresDto storesDto) { try { StoresManager storeManager = new StoresManager(); storeManager.Del(storesDto); return(new Response("Se elimino correctamente la información.", TypeResponse.Success)); } catch (Exception ex) { return(new Response("Ha ocurrido un error al eliminar la información.", TypeResponse.Error)); } }
/// <summary> /// Metodo para eliminar un registro /// </summary> /// <param name="storesDto"></param> /// <returns></returns> public Response Delete(StoresDto storesDto) { try { var action = "Stores/DelStore"; var json = ServicesHelper.MethodPost(action, storesDto); if (string.IsNullOrEmpty(json)) { throw new Exception("Se ha producido un error al eliminar Articles"); } return(JsonConvert.DeserializeObject <Response>(json)); } catch (Exception) { throw new Exception("Se ha producido un error al eliminar Articles"); } }
public ActionResult <Response> Add([FromBody] StoresDto storesDto) { try { StoresManager storeManager = new StoresManager(); if (storesDto.Id == 0) { storeManager.Add(storesDto); } else { storeManager.Upd(storesDto); } return(new Response("Se guardo correctamente la información.", TypeResponse.Success)); } catch (Exception ex) { return(new Response("Ha ocurrido un error al guardar.", TypeResponse.Error)); } }
public void Del(StoresDto store) { this.Delete(Entity(store)); }
public void Upd(StoresDto store) { this.Update(Entity(store)); }
public void Add(StoresDto store) { this.Create(Entity(store)); }