Exemple #1
0
        public bool Handler(Dalyan.Domain.Query.CompanyDeleteQuery query)
        {
            try
            {
                var obj = new Dalyan.Db.Company();
                obj = _db.Company.FirstOrDefault(x => x.Id == query.Id);

                obj.IsDeleted = true;
                _db.SaveChanges();
                return(true);
            }
            catch (Exception ex)
            {
                throw new ExceptionLog(LogType.DATABASE_DELETE, LogLevel.ERROR, ex, "DeleteQueryHandler");
            }
        }
 public Dalyan.Entities.Models.Company Handler(CompanyEditQuery query)
 {
     try
     {
         var obj = new Dalyan.Db.Company();
         obj           = _db.Company.FirstOrDefault(x => x.Id == query.Company.Id);
         obj.Id        = query.Company.Id;
         obj.Name      = query.Company.Name;
         obj.IsDeleted = query.Company.IsDeleted;
         _db.SaveChanges();
         return(query.Company);
     }
     catch (Exception ex)
     {
         throw new ExceptionLog(LogType.DATABASE_UPDATE, LogLevel.ERROR, ex, "EditQueryHandler");
     }
 }
 public Dalyan.Entities.Models.Company Handler(CompanyAddQuery query)
 {
     try
     {
         var obj = new Dalyan.Db.Company();
         obj.Id        = query.Company.Id;
         obj.Name      = query.Company.Name;
         obj.IsDeleted = query.Company.IsDeleted;
         _db.Company.Add(obj);
         _db.SaveChanges();
         query.Company.Id = obj.Id;
         return(query.Company);
     }
     catch (Exception ex)
     {
         throw new ExceptionLog(LogType.DATABASE_INSERT, LogLevel.ERROR, ex, "AddQueryHandler");
     }
 }