public bool UpdateLocationByID(LocationsDTO loc)
        {
            // save location which are in Oacy/Unsc but not in table
            Location location = new Location();

            if (loc.ID == 0)
            {
                location.CreatedDate       = DateTime.Now;
                location.Name              = loc.Name;
                location.Identifier        = loc.Identifier;
                location.PropCode          = loc.PropCode;
                location.RDUsageID         = loc.RDUsageID;
                location.PipelineID        = loc.PipelineID;
                location.IsActive          = true;
                location.CreatedBy         = loc.CreatedBy;
                location.ModifiedBy        = loc.ModifiedBy;
                location.ModifiedDate      = DateTime.Now;
                location.PipeDuns          = loc.PipelineDuns;
                location.TransactionTypeId = 0;

                DbContext.Locations.Add(location);
                DbContext.SaveChanges();
            }
            else
            {
                //update location in location table
                var objLoc = DbContext.Locations.Where(a => a.ID == loc.ID).FirstOrDefault();
                objLoc.Name       = loc.Name;
                objLoc.Identifier = loc.Identifier;
                objLoc.PropCode   = loc.PropCode;
                objLoc.RDUsageID  = loc.RDUsageID;
                // objLoc.PipelineID = loc.PipelineID;
                // objLoc.IsActive = loc.IsActive;
                //objLoc.ModifiedBy = loc.ModifiedBy;
                objLoc.ModifiedDate = DateTime.Now;
                // objLoc.PipeDuns = loc.PipeDuns; // adding pipeduns is pending
                //objLoc.TransactionTypeId = 0;
                DbContext.Entry(objLoc).State = EntityState.Modified;
                DbContext.SaveChanges();
            }
            return(true);
        }
        public IHttpActionResult PutDashNominationStatu(Guid TransactionId, int statusId)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            var obj = db.DashNominationStatus.Where(a => a.TransactionId == TransactionId).FirstOrDefault();

            if (obj == null)
            {
                return(BadRequest());
            }
            obj.StatusId = statusId;
            switch (statusId)
            {
            case 1:
            case 2:
            case 3:
            case 4:
                obj.NomStatus = "In-Process";
                break;

            case 5:
                obj.NomStatus = "Submitted";
                break;

            case 7:
                obj.NomStatus = "Accepted";
                break;

            case 8:
            case 9:
                obj.NomStatus = "Exception Occured";
                break;

            case 10:
                obj.NomStatus = "Rejected";
                break;

            case 0:
                obj.NomStatus = "GISB Unprocessed";
                break;

            default:
                obj.NomStatus = "Not Defined";
                break;
            }
            db.Entry(obj).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!DashNominationStatuExists(TransactionId))
                {
                    ApplicationLog log = new ApplicationLog();
                    log.CreatedDate = DateTime.Now;
                    log.Description = "Nomination not found TransactionId:- " + TransactionId;
                    log.Source      = "Update";
                    log.Type        = "Error";
                    db.ApplicationLogs.Add(log);
                    db.SaveChanges();
                    return(NotFound());
                }
                else
                {
                    return(Ok("fail"));
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }