public ActionResult InsertClient(ServiceReference1.Client client) { if (Session["userToken"] == null) { return(RedirectToAction("Login")); } if (string.IsNullOrEmpty(client.address) || string.IsNullOrEmpty(client.firstname) || string.IsNullOrEmpty(client.lastname) || string.IsNullOrEmpty(client.phone) ) { ViewBag.ErrorMessage = "Please provide all required information to add a new client."; return(RedirectToAction("Index")); } try { serviceRef.InsertClient(Session["userToken"].ToString(), client); } catch (Exception ex) { ViewBag.ErrorMessage = ex.Message; } return(RedirectToAction("Index")); }