Esempio n. 1
0
        public StokResponse StokKaydet([FromBody] Models.Request.StokRequest stok)
        {
            StokResponse response;

            try
            {
                if (stok.aut.password != "1234" || stok.aut.username != "ali")
                {
                    return(response = new StokResponse()
                    {
                        status = new Models.Attribute.Status()
                        {
                            code = (int)Enums.MessageCode.OturumBilgisi,
                            message = Enums.MessageCode.OturumBilgisi.ToString()
                        }
                    });
                }

                var entity = StokService.Kaydet(new Stok()
                {
                    StokID      = stok.stok.StokID,
                    StokAdi     = stok.stok.StokAdi,
                    AlisFiyati  = stok.stok.AlisFiyati,
                    SatisFiyati = stok.stok.SatisFiyati,
                    KdvOrani    = stok.stok.KdvOrani,
                    StokGrubuID = stok.stok.StokGrubuID
                });

                if (entity != null)
                {
                    return(response = new StokResponse()
                    {
                        status = new Models.Attribute.Status()
                        {
                            code = (int)Enums.MessageCode.Basarili,
                            message = Enums.MessageCode.Basarili.ToString()
                        }
                        ,
                        StokId = entity.StokID
                    });
                }
                else
                {
                    return(response = new StokResponse()
                    {
                        status = new Models.Attribute.Status()
                        {
                            code = (int)Enums.MessageCode.Basarisiz,
                            message = Enums.MessageCode.Basarisiz.ToString()
                        }
                    });
                }
            }
            catch (Exception error)
            {
                return(response = new StokResponse()
                {
                    status = new Models.Attribute.Status()
                    {
                        code = (int)Enums.MessageCode.Hata,
                        message = Enums.MessageCode.Hata.ToString() + error.Message
                    }
                });
            }
        }
Esempio n. 2
0
 public Stok Kaydet(Stok entity)
 {
     return(stokService.Kaydet(entity));;
 }