Beispiel #1
0
        public ResultModel Update(StoreRoomModel obj)
        {
            ResultModel oOutput = new ResultModel();

            try
            {
                StoreRoom oStoreRoom = dbSet.Where(m => m.ID == obj.ID).FirstOrDefault();
                if (oStoreRoom == null)
                {
                    oOutput.Status = 0;
                    oOutput.Msg    = "Record not exist";
                }
                else
                {
                    // Removing Already Added

                    Mapper.Map(obj, oStoreRoom);
                    oDB.SaveChanges();
                    oOutput.Data = Mapper.Map <StoreRoom>(oStoreRoom);
                }
            }
            catch (Exception ex)
            {
                oOutput.Status = 0;
                oOutput.Msg    = "Data access error";
                Services.Utitilty.Error(ex);
            }
            return(oOutput);
        }
Beispiel #2
0
        public ResultModel Insert(StoreRoomModel obj)
        {
            ResultModel oOutput = new ResultModel();

            try
            {
                StoreRoom oStoreRoom = Mapper.Map <StoreRoom>(obj);
                dbSet.Add(oStoreRoom);
                oDB.SaveChanges();
                oOutput.Data = Mapper.Map <StoreRoomModel>(oStoreRoom);
            }
            catch (Exception ex)
            {
                oOutput.Status = 0;
                oOutput.Msg    = "Data access error";
                Services.Utitilty.Error(ex);
            }
            return(oOutput);
        }
Beispiel #3
0
 public ResultModel Put([FromBody] StoreRoomModel obj)
 {
     return(_svr.Update(obj));
 }
Beispiel #4
0
 public ResultModel Post([FromBody] StoreRoomModel obj)
 {
     return(_svr.Insert(obj));
 }