public ActionResult GSTPercentage(GSTPercentage obj, FormCollection fc) { if (bl_gst.Check_Tax(obj.gstTax, obj.gstTaxID)) { if (bl_gst.SAVE(obj)) { if (obj.gstTaxID == 0) { ModelState.Clear(); TempData["Msg"] = "GST Percentage Saved Successfully !"; return(RedirectToAction("GSTPercentage", "GSTPercentage")); } else { ModelState.Clear(); TempData["Msg"] = "GST Percentage Updated Successfully !"; return(RedirectToAction("GSTPercentage", "GSTPercentage")); } } else { ModelState.Clear(); TempData["Msg"] = "GST Percentage Not Saved !"; return(RedirectToAction("GSTPercentage", "GSTPercentage")); } } else { ViewData["flag"] = "Error"; TempData["Msg"] = "GST Percentage Already Exists !"; return(RedirectToAction("GSTPercentage", "GSTPercentage")); } }
// POST: odata/GSTPercentages public IHttpActionResult Post(GSTPercentage gSTPercentage) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.GSTPercentages.Add(gSTPercentage); db.SaveChanges(); return(Created(gSTPercentage)); }
public bool SAVE(GSTPercentage obj) { try { Connect(); SqlCommand cmd = new SqlCommand("IUGSTPercentage", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@HospitalID", HospitalID); cmd.Parameters.AddWithValue("@LocationID", LocationID); if (obj.gstTaxID == 0) { cmd.Parameters.AddWithValue("@Mode", "ADD"); cmd.Parameters.AddWithValue("@GSTID", 0); } else { cmd.Parameters.AddWithValue("@Mode", "Edit"); cmd.Parameters.AddWithValue("@GSTID", obj.gstTaxID); } cmd.Parameters.AddWithValue("@GSTTAX", obj.gstTax); if (obj.gstDiscountValue == null || obj.gstDiscountValue == "") { cmd.Parameters.AddWithValue("@GSTDiscValue", ""); } else { cmd.Parameters.AddWithValue("@GSTDiscValue", obj.gstDiscountValue); } cmd.Parameters.AddWithValue("@CreationID", UserID); con.Open(); int i = cmd.ExecuteNonQuery(); con.Close(); if (i > 0) { return(true); } else { return(false); } } catch (Exception ex) { return(false); } }
// DELETE: odata/GSTPercentages(5) public IHttpActionResult Delete([FromODataUri] int key) { GSTPercentage gSTPercentage = db.GSTPercentages.Find(key); if (gSTPercentage == null) { return(NotFound()); } db.GSTPercentages.Remove(gSTPercentage); db.SaveChanges(); return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult Patch([FromODataUri] int key, Delta <GSTPercentage> patch) { Validate(patch.GetEntity()); if (!ModelState.IsValid) { return(BadRequest(ModelState)); } GSTPercentage gSTPercentage = db.GSTPercentages.Find(key); if (gSTPercentage == null) { return(NotFound()); } patch.Patch(gSTPercentage); try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!GSTPercentageExists(key)) { return(NotFound()); } else { throw; } } return(Updated(gSTPercentage)); }