public void Add(HatırlatıcıModel model, bool saveChanges = true) { try { var entity = new Hatırlatıcı() { Id = model.Id, Name = model.Name, Details = model.Details, DateTime = model.DateTime, MachineId = model.MachineId, To = model.To, From = model.From }; hatRepository.AddEntity(entity); if (saveChanges) { hatRepository.SaveChanges(); } } catch (Exception exc) { throw exc; } }
// Parametre olarak gönderilen entity'i repository'e ekler ve unit of work üzerinden veritabanına kaydetme işlemini gerçekleştirir public virtual TEntity AddEntity(TEntity entity, bool saveChanges = true) { try { repository.AddEntity(entity); if (saveChanges) { unitOfWork.SaveChanges(); } return(entity); } catch (Exception exc) { throw exc; } }
public void Add(UserModel model, bool saveChanges = true) { User entity = new User() { Id = model.Id, Name = model.Name, Password = model.Password, RoleId = model.RoleId, FactoryId = model.FactoryId, Mail = model.Mail }; userRepository.AddEntity(entity); if (saveChanges) { userRepository.SaveChanges(); } }
public void Add(FactoryModel model, bool saveChanges = true) { try { Factory entity = new Factory() { Id = model.Id, Name = model.Name, }; factoryRepository.AddEntity(entity); if (saveChanges) { factoryRepository.SaveChanges(); } } catch (Exception e) { throw e; } }
public void Add(CategoryModel model, bool saveChanges = true) { try { var entity = new Category() { Id = model.Id, Name = model.Name }; repository.AddEntity(entity); if (saveChanges) { SaveChanges(); } } catch (Exception exc) { throw exc; } }
public void Add(SectionModel model, bool saveChanges = true) { try { var entity = new Section() { Id = model.Id, Name = model.Name, FactoryId = model.FactoryId }; if (saveChanges) { sectionRepository.SaveChanges(); } sectionRepository.AddEntity(entity); } catch (Exception e) { throw e; } }
public void Add(ProductModel model, bool saveChanges = true) { try { var entity = new Product() { Name = model.Name, UnitPrice = model.UnitPrice, StockAmount = model.StockAmount, CategoryId = model.CategoryId, CreateDate = DateTime.Now }; repository.AddEntity(entity); if (saveChanges) { SaveChanges(); } } catch (Exception exc) { throw exc; } }
public void Add(MachineModel model, bool saveChanges = true) { try { var entity = new Machine() { Name = model.Name, SeriNO = model.SeriNO, Model = model.Model, Detail = model.Detail, SectionId = model.SectionId, }; machineRepository.AddEntity(entity); if (saveChanges) { machineRepository.SaveChanges(); } } catch (Exception e) { throw e; } }