public DbResponse FaqAdd(ProductFaqAddModel model, string customerUserName) { try { var customerId = _db.Registration.CustomerIdByUserName(customerUserName); if (customerId == 0) { return(new DbResponse(false, "Invalid User")); } model.CustomerId = customerId; _db.ProductFaq.Add(model); _db.SaveChanges(); return(new DbResponse(true, "Success")); } catch (Exception e) { return(new DbResponse(false, e.Message)); } }
public IActionResult PostFaq(ProductFaqAddModel model) { var response = _product.FaqAdd(model, User.Identity.Name); return(Json(response)); }