public ActionResult Create(Models.SenCompany collection) { try { int outputId = _dataobject.Insert(collection); return(RedirectToAction(this.ActionReturn())); } catch (Exception ex) { Services.GlobalErrors.Parse(ModelState, _dataobject.Errors, ex); return(PartialView(this._updateview, collection)); } }
public int Update(Models.SenCompany data) { try { this.Validate(data); this._db.Entry(data).State = System.Data.Entity.EntityState.Modified; this._db.SaveChanges(); return(data.CompanyId); } catch (Exception) { throw; } }
public int Insert(Models.SenCompany data) { try { this.Validate(data); data.CreateDate = DateTime.UtcNow; this._db.SenCompanys.Add(data); this._db.SaveChanges(); var userservicenew = new Models.SenService() { CompanyId = data.CompanyId, UserId = data.UserId ?? Guid.Empty }; this._db.SenServices.Add(userservicenew); this._db.SaveChanges(); return(data.CompanyId); } catch (Exception) { throw; } }