示例#1
0
 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;
     }
 }
示例#2
0
 // 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();
            }
        }
示例#4
0
 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;
     }
 }
示例#5
0
 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;
     }
 }
示例#7
0
 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;
     }
 }
示例#8
0
 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;
     }
 }