public void Add(Size entity) { using (var db = new BatikStoreEntities()) { db.Sizes.AddObject(entity); db.SaveChanges(); } }
public void Update(Size entity) { using (var db = new BatikStoreEntities()) { var existing = db.Sizes.SingleOrDefault(c => c.Id == entity.Id); if (existing != null) { db.Sizes.ApplyCurrentValues(entity); db.SaveChanges(); } } }
public ResponseMessage Update(Size entity) { ResponseMessage response = new ResponseMessage(); if (_productService.IsSizeAlreadyUsed(entity.Id) == true) { response.IsError = true; response.ErrorCodes.Add(string.Format(GeneralLocalisations.CannotBeEdited, SizeLocalisations.Size)); return response; } _sizeRepository.Update(entity); return response; }
/// <summary> /// Deprecated Method for adding a new object to the Sizes EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToSizes(Size size) { base.AddObject("Sizes", size); }
/// <summary> /// Create a new Size object. /// </summary> /// <param name="id">Initial value of the Id property.</param> /// <param name="name">Initial value of the Name property.</param> public static Size CreateSize(global::System.Int32 id, global::System.String name) { Size size = new Size(); size.Id = id; size.Name = name; return size; }
public void Add(Size entity) { _sizeRepository.Add(entity); }