//----------------------->>>>>Add quotation and services here.....
        public JsonResult AddQuotation(srv[] ar, quotation ob)
        {
            if (ModelState.IsValid)
            {
                return this.Json("-------", JsonRequestBehavior.AllowGet);
            }
            try
            {
                Quotation obj = new Quotation();
                obj.Date = ob.date;
                obj.ShipperId = ob.shipperid;
                obj.ComodityId = ob.comodityid;
                obj.Quantity = ob.quantity;
                obj.PackingId = ob.packingid;
                obj.Weight = ob.weight;
                obj.LoadingPort = ob.loadingport;
                obj.DischargePort = ob.dischargeport;
                obj.FlightNo = ob.flightno;
                obj.SailingDate = ob.sailingdate;
                obj.ArrivalDate = ob.arrivaldate;
                obj.ConsigneeId = ob.consigneeid;
                obj.Status = "inactive";
                obj.PayedAmount = 0;

                db.Quotations.Add(obj);
                db.SaveChanges();

                int id = obj.Id;

                ServiceForQuotation sample = new ServiceForQuotation();

                foreach (var a in ar)
                {
                    sample.Quantity = a.quantity;
                    sample.UnitPrice = a.price;
                    sample.QuotationId = id;
                    sample.ServiceId = a.id;
                    db.ServiceForQuotations.Add(sample);
                    db.SaveChanges();
                }
                return this.Json("success", JsonRequestBehavior.AllowGet);
            }
            catch(Exception e)
            {
                return this.Json("-------", JsonRequestBehavior.AllowGet);
            }
        }
        public JsonResult EditQuotation(srv[] ar, quotation ob)
        {
            try
            {
                Quotation obj = new Quotation();
                obj.Id = ob.id;
                obj.Date = ob.date;
                obj.ShipperId = ob.shipperid;
                obj.ComodityId = ob.comodityid;
                obj.Quantity = ob.quantity;
                obj.PackingId = ob.packingid;
                obj.Weight = ob.weight;
                obj.LoadingPort = ob.loadingport;
                obj.DischargePort = ob.dischargeport;
                obj.FlightNo = ob.flightno;
                obj.SailingDate = ob.sailingdate;
                obj.ArrivalDate = ob.arrivaldate;
                obj.ConsigneeId = ob.consigneeid;
                obj.Status = ob.status;
                obj.PayedAmount = ob.payedamount;

                db.Entry(obj).State = EntityState.Modified;
                db.SaveChanges();

                int id = obj.Id;

                var list = db.ServiceForQuotations.Where(x => x.QuotationId == id).Select(x => x).ToList();

                foreach (var a in list)
                {
                    db.ServiceForQuotations.Remove(a);
                    db.SaveChanges();
                }

                ServiceForQuotation sample = new ServiceForQuotation();
                foreach (var a in ar)
                {
                    sample.Quantity = a.quantity;
                    sample.UnitPrice = a.price;
                    sample.QuotationId = id;
                    sample.ServiceId = a.id;
                    db.ServiceForQuotations.Add(sample);
                    db.SaveChanges();
                }
                return this.Json("success", JsonRequestBehavior.AllowGet);
            }catch(Exception e)
            {
                return this.Json("----",JsonRequestBehavior.AllowGet);
            }
        }