public ActionResult DeleteConfirmed(int id)
        {
            PriceListMaster priceListMaster = db.PriceListMasters.Find(id);

            db.PriceListMasters.Remove(priceListMaster);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public ActionResult Edit([Bind(Include = "PriceListID,PriceListName,PriceListDateActivation,PriceListFinishDate,CreationDate,CreateBy,ModifiedDate,ModifiedBy,Status")] PriceListMaster priceListMaster)
 {
     if (ModelState.IsValid)
     {
         db.Entry(priceListMaster).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(priceListMaster));
 }
        // GET: PriceListMasters/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            PriceListMaster priceListMaster = db.PriceListMasters.Find(id);

            if (priceListMaster == null)
            {
                return(HttpNotFound());
            }
            return(View(priceListMaster));
        }
Example #4
0
        private async Task <PriceListMaster> PrepareRepositoryTable(DataRow dataRow)
        {
            var modelCode   = Convert.ToString(dataRow["ModelCode"]);
            var varient     = Convert.ToString(dataRow["Varient"]);
            var varientType = Convert.ToString(dataRow["VarientType"]);

            if (string.IsNullOrEmpty(modelCode) || string.IsNullOrEmpty(varientType))
            {
                return(null);
            }

            var isModelPriceExist = await _priceListMasterService.GetModelPriceByModelCodeAsync(modelCode, varient, varientType);

            if (isModelPriceExist != null)
            {
                return(null);
            }

            var modelPrice = new PriceListMaster();

            if (dataRow.Table.Columns.Contains("ModelCode"))
            {
                modelPrice.ModelCode = Convert.ToString(dataRow["ModelCode"]);
            }

            if (dataRow.Table.Columns.Contains("Varient"))
            {
                modelPrice.ModelVarient = Convert.ToString(dataRow["Varient"]);
            }

            if (dataRow.Table.Columns.Contains("VarientType"))
            {
                modelPrice.VarientType = Convert.ToString(dataRow["VarientType"]);
            }

            if (dataRow.Table.Columns.Contains("ExShowroomPrice"))
            {
                modelPrice.ExShowroomPrice = Convert.ToDecimal(dataRow["ExShowroomPrice"]);
            }

            if (dataRow.Table.Columns.Contains("FastTag"))
            {
                modelPrice.FastTag = Convert.ToDecimal(dataRow["FastTag"]);
            }

            if (dataRow.Table.Columns.Contains("TCS"))
            {
                modelPrice.Tcs = Convert.ToDecimal(dataRow["TCS"]);
            }

            if (dataRow.Table.Columns.Contains("HAInsurance"))
            {
                modelPrice.Hainsurance = Convert.ToDecimal(dataRow["HAInsurance"]);
            }

            if (dataRow.Table.Columns.Contains("HANilDepWithKeyProtect"))
            {
                modelPrice.HanilDepWithKeyProtect = Convert.ToDecimal(dataRow["HANilDepWithKeyProtect"]);
            }

            if (dataRow.Table.Columns.Contains("HARTIWithEngineProtect"))
            {
                modelPrice.HartiwithEngineProtect = Convert.ToDecimal(dataRow["HARTIWithEngineProtect"]);
            }

            if (dataRow.Table.Columns.Contains("RTOIndividual"))
            {
                modelPrice.Rtoindividual = Convert.ToDecimal(dataRow["RTOIndividual"]);
            }

            if (dataRow.Table.Columns.Contains("AccessoryComboKit"))
            {
                modelPrice.AccessoryComboKit = Convert.ToDecimal(dataRow["AccessoryComboKit"]);
            }

            if (dataRow.Table.Columns.Contains("ExtendedWarranty"))
            {
                modelPrice.ExtendedWarranty = Convert.ToDecimal(dataRow["ExtendedWarranty"]);
            }

            if (dataRow.Table.Columns.Contains("RSA"))
            {
                modelPrice.Rsa = Convert.ToDecimal(dataRow["RSA"]);
            }

            if (dataRow.Table.Columns.Contains("ClayBar"))
            {
                modelPrice.ClayBar = Convert.ToDecimal(dataRow["ClayBar"]);
            }

            if (dataRow.Table.Columns.Contains("Antirust"))
            {
                modelPrice.Antirust = Convert.ToDecimal(dataRow["Antirust"]);
            }

            if (dataRow.Table.Columns.Contains("CarpetLamination"))
            {
                modelPrice.CarpetLamination = Convert.ToDecimal(dataRow["CarpetLamination"]);
            }

            if (dataRow.Table.Columns.Contains("TotatPrice"))
            {
                modelPrice.TotatPrice = Convert.ToDecimal(dataRow["TotatPrice"]);
            }



            modelPrice.DateCreated = DateTime.UtcNow;
            modelPrice.DateUpdated = DateTime.UtcNow;
            modelPrice.ByUser      = Convert.ToInt32(HttpContext.User.FindFirst(claim => claim.Type == System.Security.Claims.ClaimTypes.NameIdentifier)?.Value);;
            return(modelPrice);
        }