public string AddOrg(OrgShort org) { var result = "Success"; var qry = (from orgData in Organization where orgData.parentid == org.parentid && orgData.organizationname == org.organizationname && orgData.organizationtypeid == org.organizationtypeid select orgData); if (qry.Any()) { return("Duplicate values, Data with same name exists!"); } var item = new Organization(); item.organizationname = org.organizationname; item.organizationtypeid = org.organizationtypeid; item.parentid = org.parentid; item.code = org.code; item.createdby = org.createdby; item.creationtime = DateTime.Now; item.isdeleted = false; this.Organization.Add(item); this.SaveChanges(); return(result); }
public string UpdateOrg(OrgShort org) { var result = "Success"; var qry = (from orgData in Organization where orgData.parentid == org.parentid && orgData.organizationname == org.organizationname && orgData.organizationtypeid == org.organizationtypeid select orgData); if (qry.Any()) { return("Duplicate values, Data with same name exists!"); } var item = this.Organization.Where(ob => ob.organizationid == org.organizationid).FirstOrDefault(); if (item != null) { item.organizationname = org.organizationname; item.modifiedby = org.createdby; item.modifiedtime = DateTime.Now; this.Organization.Update(item); this.SaveChanges(); } return(result); }
public string DeleteOrg(OrgShort org) { var inp = Mapper.Map <DataModels.Organization.OrgShort>(org); var result = Repository.DeleteOrg(inp); return(result); }
public JsonResult DeleteOrg([FromBody] OrgShort value) { var result = BusinessService.DeleteOrg(value); var ret = $"{{\"msg\":\"{result}\"}}"; return(new JsonResult(ret)); }
public string DeleteOrg(OrgShort org) { string result = "Success"; string sp = "", query = "", criteria = ""; sp = "delorganization"; criteria = string.Format("{0},{1}", org.organizationid, org.organizationtypeid); query = DbUtility.GetSPName(this.ProviderName, sp, criteria); var recs = this.Scaler.FromSql(query); result = recs.ToList()[0].delorganization; return(result == ""?"Success":result); }
public string Update(OrgShort org) { var input = Mapper.Map <DataModels.Organization.OrgShort>(org); return(Repository.UpdateOrg(input)); }