public ActionResult Add_Location(Add_Location_Category lc)
      {
          string   user = Membership.GetUser().ToString();
          DateTime date = DateTime.Now;

          Managing_agent_repository.Add_Loc(lc, user, date);
          string message = "SUCCESS";

          return(Json(new { Message = message, JsonRequestBehavior.AllowGet }));
      }
Пример #2
0
        public static void Add_Loc(Add_Location_Category lc, string username, DateTime date)
        {
            DynamicParameters param = new DynamicParameters();

            param.Add("@Lname", lc.Name);
            param.Add("@Lcreated_by", username);
            param.Add("@Lcreated_on", date);
            param.Add("@Lis_active", "Active");
            string constr = ConfigurationManager.ConnectionStrings["myconnection"].ToString();

            using (SqlConnection con = new SqlConnection(constr))
            {
                con.Open();
                con.Execute("Add_Location", param, commandType: CommandType.StoredProcedure);
                con.Close();
            }
        }