コード例 #1
0
 public JsonResult GroupDelete(int id)
 {
     if (_serviceGroupsOfEmployee.GetById(id) != null)
     {
         GroupsOfEmployee p = _serviceGroupsOfEmployee.GetById(id);
         p.IsActive = false;
         _serviceGroupsOfEmployee.Update(p);
         return(Json(true, JsonRequestBehavior.AllowGet));
     }
     else
     {
         return(Json(false, JsonRequestBehavior.AllowGet));
     }
 }
コード例 #2
0
        public static GroupsOfEmployee ModelToEnity(this GroupsOfEmployeeModel model, bool virtualActive = false)
        {
            GroupsOfEmployee entity = new GroupsOfEmployee()
            {
                 DepartmentId=model.DepartmentId,
                  Name=model.Name,
                Id = model.Id,
                IsActive = model.IsActive
            };
            if (virtualActive)
            {
                entity.Employees = model.Employees;
                entity.Department = model.Department;

            }
            return entity;
        }
コード例 #3
0
        public static GroupsOfEmployee ModelToEnity(this GroupsOfEmployeeModel model, bool virtualActive = false)
        {
            GroupsOfEmployee entity = new GroupsOfEmployee()
            {
                DepartmentId = model.DepartmentId,
                Name         = model.Name,
                Id           = model.Id,
                IsActive     = model.IsActive
            };

            if (virtualActive)
            {
                entity.Employees  = model.Employees;
                entity.Department = model.Department;
            }
            return(entity);
        }
コード例 #4
0
 public static GroupsOfEmployeeModel EntityToModel(this GroupsOfEmployee entity, bool virtualActive = false)
 {
     try
     {
         GroupsOfEmployeeModel model = new GroupsOfEmployeeModel()
         {
             DepartmentId = entity.DepartmentId,
             Name         = entity.Name,
             IsActive     = entity.IsActive,
             Id           = entity.Id
         };
         if (virtualActive)
         {
             model.Department = entity.Department;
             model.Employees  = entity.Employees;
         }
         return(model);
     }
     catch (Exception)
     {
         return(new GroupsOfEmployeeModel());
     }
 }