public void InsertBrand(BrandColumnModel model) { try { using (this.unitOfWork) { var item = new Brand() { BrandName = model.BrandName, IsDeleted = model.IsDeleted, }; this.unitOfWork.Context.AddToBrand(item); string action = string.Format("Added new Brand - {0}", item.BrandName); this.actionLogController.AddToLog(action, UserInfo.UserId); this.unitOfWork.SaveChanges(); } } catch (Exception ex) { throw ex; } }
public void UpdateBrand(BrandColumnModel model) { try { using (this.unitOfWork) { var item = FetchBrandById(model.Id); if (item != null) { item.BrandName = model.BrandName; item.IsDeleted = model.IsDeleted; } string action = string.Format("Updated Brand - {0}", item.BrandName); this.actionLogController.AddToLog(action, UserInfo.UserId); this.unitOfWork.SaveChanges(); } } catch (Exception ex) { throw ex; } }