public void Add(Origin entity)
 {
     using (var db = new BatikStoreEntities())
     {
         db.Origins.AddObject(entity);
         db.SaveChanges();
     }
 }
 public void Update(Origin entity)
 {
     using (var db = new BatikStoreEntities())
     {
         var existing = db.Origins.SingleOrDefault(c => c.Id == entity.Id);
         if (existing != null)
         {
             db.Origins.ApplyCurrentValues(entity);
             db.SaveChanges();
         }
     }
 }
Пример #3
0
 public ResponseMessage Update(Origin entity)
 {
     ResponseMessage response = new ResponseMessage();
     if (_productService.IsOriginAlreadyUsed(entity.Id) == true)
     {
         response.IsError = true;
         response.ErrorCodes.Add(string.Format(GeneralLocalisations.CannotBeDeleted, OriginLocalisations.Origin));
         return response;
     }
     _originRepository.Update(entity);
     return response;
 }
 /// <summary>
 /// Create a new Origin object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 /// <param name="name">Initial value of the Name property.</param>
 public static Origin CreateOrigin(global::System.Int32 id, global::System.String name)
 {
     Origin origin = new Origin();
     origin.Id = id;
     origin.Name = name;
     return origin;
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the Origins EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToOrigins(Origin origin)
 {
     base.AddObject("Origins", origin);
 }
Пример #6
0
 public void Add(Origin entity)
 {
     _originRepository.Add(entity);
 }