public SPResponse ActiveInactiveSourceType(int SourceTypeid) { tblSourceType objsourcetype = new tblSourceType(); SPResponse result = new SPResponse(); using (var context = new CommonDBContext()) { objsourcetype = context.tblSourceTypes.Where(x => x.SourceTypeId == SourceTypeid).FirstOrDefault(); if (objsourcetype.IsActive == true) { objsourcetype.IsActive = false; } else { objsourcetype.IsActive = true; } context.tblSourceTypes.AddOrUpdate(objsourcetype); context.SaveChanges(); result.ResponseCode = "00"; result.ResponseMessage = "Source Type Updated Successfully"; } return(result); }
public ActionResult AddSourceType(string jsonData) { SPResponse result = new SPResponse(); var userDetails = (CustomerLoginDetail)Session["UserSession"]; string SourceTypeId = ""; try { JavaScriptSerializer json_serializer = new JavaScriptSerializer(); json_serializer.MaxJsonLength = int.MaxValue; object[] objData = (object[])json_serializer.DeserializeObject(jsonData); tblSourceType objsourcetype = new tblSourceType(); foreach (Dictionary <string, object> item in objData) { objsourcetype.SourceTypeName = Convert.ToString(item["SourceTypeNm"]); objsourcetype.CreatedBy = userDetails.LoginId; objsourcetype.CreatedDate = DateTime.Now; SourceTypeId = Convert.ToString(item["SourceTypeId"]); objsourcetype.IsActive = Convert.ToBoolean(item["IsActive"]); if (SourceTypeId != "") { objsourcetype.SourceTypeId = Convert.ToInt32(SourceTypeId); } else { } } result = COR.AddSourceType(objsourcetype); } catch (Exception ex) { } return(Json(result, JsonRequestBehavior.AllowGet)); }
public tblSourceType GetSourceTypeById(int SourceTypeId) { tblSourceType objSourcetype = new tblSourceType(); using (var context = new CommonDBContext()) { objSourcetype = context.tblSourceTypes.Where(x => x.SourceTypeId == SourceTypeId).FirstOrDefault(); } return(objSourcetype); }
public ActionResult GetSourceType(int SourceTypeId) { tblSourceType objSourceType = new tblSourceType(); try { objSourceType = COR.GetSourceTypeById(SourceTypeId); } catch (Exception ex) { } return(Json(objSourceType, JsonRequestBehavior.AllowGet)); }
public SPResponse AddSourceType(tblSourceType objtblSourceType) { SPResponse result = new SPResponse(); try { using (var context = new CommonDBContext()) { context.tblSourceTypes.AddOrUpdate(objtblSourceType); context.SaveChanges(); result.ResponseCode = "00"; result.ResponseMessage = "Source Type Added Successfully"; } } catch (Exception ex) { newexception.AddException(ex, "onboarding_master"); } return(result); }