public static string DeleteRisk(string id) { GuruETCEntities _etc; string msg = string.Empty; int getID = int.Parse(id); try { using (_etc = new DB.GuruETCEntities()) { Risk_Assessment _risk = _etc.Risk_Assessment.Where(d => d.Id == getID).FirstOrDefault(); if (_risk != null) { _etc.DeleteObject(_risk); _etc.SaveChanges(); } } msg = "Success"; } catch (Exception ex) { msg = "Error"; } return(msg); }
public static string EditRisk(string id, string title, string desc, string type) { GuruETCEntities _etc; string msg = string.Empty; int getID = int.Parse(id); try { using (_etc = new DB.GuruETCEntities()) { Risk_Assessment _risk = _etc.Risk_Assessment.Where(d => d.Id == getID).FirstOrDefault(); _risk.Risk = title; _risk.Description = desc; _risk.Risk_Type = type; _etc.SaveChanges(); } msg = "Success"; } catch (Exception ex) { msg = "Error"; } return(msg); }
public static string AddRisk(string title, string desc, string type) { GuruETCEntities _etc; string msg = string.Empty; try { using (_etc = new DB.GuruETCEntities()) { Risk_Assessment _risk = new Risk_Assessment(); _risk.Risk = title; _risk.Description = desc; _risk.Risk_Type = type; _etc.AddToRisk_Assessment(_risk); _etc.SaveChanges(); return("Success_" + _risk.Id); } } catch (Exception ex) { msg = "Error"; } return(msg); }