コード例 #1
0
        public static PermitsModel EntityToModel(this Permits entity, bool virtualActive = false)
        {
            try
            {
                PermitsModel model = new PermitsModel()
                {
                    EmployeeId = entity.EmployeeId,
                    EndDate = entity.EndDate,
                    PermitTypeId = entity.PermitTypeId,
                    StartingDate = entity.StartingDate,
                    IsActive = entity.IsActive,
                    Id = entity.Id
                };
                if (virtualActive)
                {
                    model.PermitType = entity.PermitType;
                    model.Employee = entity.Employee;

                }
                return model;
            }
            catch (Exception)
            {

                return new PermitsModel();
            }
        }
コード例 #2
0
 public ActionResult PermitInsert(PermitsModel permitsModel)
 {
     Permits permit = permitsModel.ModelToEnity();
     permit.IsActive = true;
     _servicePermits.Insert(permit);
     return RedirectToAction("PermitList");
 }
コード例 #3
0
 public ActionResult PermitEdit(PermitsModel permits)
 {
     Permits permit = permits.ModelToEnity(true);
     permit.IsActive = true;
     _servicePermits.Update(permit);
     return RedirectToAction("PermitList");
 }