public ActionResult CallMe(CallMeModel model) { var objMsg = new MessageModel { Message = "Số điện thoại không đúng định dạng." }; if (ModelState.IsValid) { model.UserId = 0; int id = _productBo.CallMe_Insert(model); if (id > 0) { objMsg.Message = "Chúng tôi sẽ liên hệ với bạn trong thời gian sớm nhất!"; } else { objMsg.Message = "Có lỗi trong quá trình gửi email, Xin vui lòng thử lại sau."; } } return(Json(objMsg)); }
public int CallMe_Insert(CallMeModel model) { int id = 0; string storeName = "CallMe_Insert"; try { using (IDbContext context = Context()) { id = context.StoredProcedure(storeName) .Parameter("SDT", model.Phone, DataTypes.String) .Parameter("ProductId", model.ProductId, DataTypes.Int32) .Parameter("UserId", model.UserId, DataTypes.Int32) .QuerySingle <int>(); } } catch (Exception ex) { throw new Exception(string.Format("{0} => {1}", storeName, ex)); } return(id); }
public int CallMe_Insert(CallMeModel model) { return(_productDal.CallMe_Insert(model)); }