public ActionResult CollectionCenter(CollectionCenter obj, FormCollection fc) { try { BL_CollectionCenter _CollectionCenter = new BL_CollectionCenter(); if (_CollectionCenter.CheckCollectionCenter(obj.CollectionID, obj.CollectionName)) { if (obj.CollectionID == "0" || obj.CollectionID == null) { obj.CollectionID = "0"; } else { obj.CollectionID = (fc["CollectionID"]); } if (obj.CollectionName == "" || obj.CollectionName == null) { obj.CollectionName = ""; } else { obj.CollectionName = fc["CollectionName"].ToString(); } if (obj.Mobile == "") { obj.Mobile = ""; } else { obj.Mobile = fc["MobileNo"].ToString(); } if (obj.PhoneNo == "") { obj.PhoneNo = ""; } else { obj.PhoneNo = fc["Phone"].ToString(); } if (obj.Address == "" || obj.Address == null) { obj.Address = ""; } else { obj.Address = fc["Address"].ToString(); } if (obj.Email == "") { obj.Email = ""; } else { obj.Email = fc["EmailID"].ToString(); } if (obj.AdminInCharge == "") { obj.AdminInCharge = ""; } else { obj.AdminInCharge = fc["Admin"].ToString(); } if (_CollectionCenter.SaveTest(obj)) { if (Convert.ToInt32(obj.CollectionID) > 0) { ModelState.Clear(); TempData["Msg"] = "Collection Center Updated Successfully !"; return(RedirectToAction("CollectionCenter", "CollectionCenter")); } else { ModelState.Clear(); TempData["Msg"] = "Collection Center Saved Successfully !"; return(RedirectToAction("CollectionCenter", "CollectionCenter")); } } } else { ViewData["flag"] = "Error"; TempData["Msg"] = "Collection Center Already Exists !"; } return(RedirectToAction("CollectionCenter", "CollectionCenter")); } catch (Exception) { return(RedirectToAction("CollectionCenter", "CollectionCenter")); } }