public FeaturePermisionResponse InsertFeaturePermision(FeaturePermisionEntity featurePermision) { var featurePermisionResponse = new FeaturePermisionResponse { Acknowledge = AcknowledgeType.Success }; if (featurePermision != null) { if (!featurePermision.Validate()) { foreach (string error in featurePermision.ValidationErrors) { featurePermisionResponse.Message += error + Environment.NewLine; } featurePermisionResponse.Acknowledge = AcknowledgeType.Failure; return(featurePermisionResponse); } if (string.IsNullOrEmpty(featurePermision.FeaturePermisionID)) { featurePermision.FeaturePermisionID = Guid.NewGuid().ToString(); } featurePermisionResponse.Message = FeaturePermisionDao.InsertFeaturePermision(featurePermision); featurePermisionResponse.FeaturePermisionID = featurePermision.FeaturePermisionID; if (!string.IsNullOrEmpty(featurePermisionResponse.Message)) { featurePermisionResponse.Acknowledge = AcknowledgeType.Failure; return(featurePermisionResponse); } } return(featurePermisionResponse); }
public FeaturePermisionResponse DeleteFeaturePermision(string FeatureID) { var response = new FeaturePermisionResponse { Acknowledge = AcknowledgeType.Success }; try { //xóa quyền cũ trước khi phân quyền response.Message = FeaturePermisionDao.DeleteFeaturePermision(FeatureID); return(response); } catch (Exception ex) { response.Message = ex.Message; return(response); } }