Пример #1
0
 public ActionResult Edit(int FarmId, Models.GapFarm collection)
 {
     try
     {
         int outputId = _dataobject.Update(collection);
         return(RedirectToAction(this.ActionReturn()));
     }
     catch (Exception ex)
     {
         Services.GlobalErrors.Parse(ModelState, _dataobject.Errors, ex);
         return(PartialView(this._updateview, collection));
     }
 }
Пример #2
0
        public int Update(Models.GapFarm data)
        {
            try
            {
                this.Validate(data);

                data.ModifiedBy       = GlobalVariant.GetAppUser().UserID;
                data.ModifiedDateTime = DateTime.Now;

                var _data = this.GetById2(data.FarmId);


                this.MapView2Table(data, _data);
                this._db.Entry(_data).State = System.Data.Entity.EntityState.Modified;
                this._db.SaveChanges();

                return(data.FarmId);
            }
            catch (Exception)
            {
                throw;
            }
        }
Пример #3
0
        public int Insert(Models.GapFarm data)
        {
            try
            {
                this.Validate(data);

                data.CreatedBy       = GlobalVariant.GetAppUser().UserID;
                data.CreatedDateTime = DateTime.Now;

                var _data = new Models.GapFarm();
                this.MapView2Table(data, _data);



                this._db.GapFarms.Add(_data);
                this._db.SaveChanges();
                return(data.FarmId);
            }
            catch (Exception)
            {
                throw;
            }
        }