public JsonResult AddACLExceptions(ICollection <ComponentACLExceptionDTO> model) { ComponentACLExceptionDTO result = new ComponentACLExceptionDTO(); foreach (ComponentACLExceptionDTO row in model) { try { var entity = Mapper.Map <tbl_ACLAccountExceptions>(result); entity.comp_id = row.comp_id; entity.account_id = row.account_id; if (entity.expiration_date != null) { entity.expiration_date = Convert.ToDateTime(row.expiration_date); } else { entity.expiration_date = System.DateTime.Now; } UnitOfWork.TblACLAccountExceptions.Add(entity); UnitOfWork.Save(); result = Mapper.Map <ComponentACLExceptionDTO>(entity); } catch (Exception ex) { _logger.Error(ex); result = null; } } return(Json(result, JsonRequestBehavior.AllowGet)); }
public JsonResult UpdateACLExceptions(ComponentACLExceptionDTO dto) { bool result = false; try { var entity = UnitOfWork.TblACLAccountExceptions.Get(dto.id); if (entity != null) { entity.expiration_date = Convert.ToDateTime(dto.expiration_date); UnitOfWork.Save(); result = true; } } catch (Exception ex) { _logger.Error(ex); result = false; } return(Json(result, JsonRequestBehavior.AllowGet)); }