Exemple #1
0
 private Stores Entity(StoresDto storeDto)
 {
     return(new Stores()
     {
         Address = storeDto.Address,
         Id = storeDto.Id,
         Name = storeDto.Name
     });
 }
Exemple #2
0
        /// <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();
        }
Exemple #3
0
        /// <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();
        }
Exemple #4
0
        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");
     }
 }
Exemple #6
0
        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));
            }
        }
Exemple #7
0
 public void Del(StoresDto store)
 {
     this.Delete(Entity(store));
 }
Exemple #8
0
 public void Upd(StoresDto store)
 {
     this.Update(Entity(store));
 }
Exemple #9
0
 public void Add(StoresDto store)
 {
     this.Create(Entity(store));
 }