protected string GetImageUrl(PromotionRequest promotion)
        {
            string guid = string.Empty;

            if (ThumbnailSetting != string.Empty)
            {
                PromotionRequestDocument doc = promotion.Documents.GetFirstByType(int.Parse(ThumbnailSetting));
                if (doc != null)
                {
                    guid = doc.GUID.ToString();
                }
            }
            else
            {
                guid = promotion.WebSummaryImageBlob.GUID.ToString();
            }

            if (guid != string.Empty)
            {
                return(string.Format("CachedBlob.aspx?guid={0}&width={1}&height={2}{3}", guid, WidthSetting, HeightSetting, ImageEffect));
            }
            else
            {
                return(string.Empty);
            }
        }
        public PromotionDTO CreatePromotion(PromotionRequest promotionRequest)
        {
            var isExist = dbContext.Promotions.Where(p => p.Code == promotionRequest.Code && p.IsActive == true).FirstOrDefault();

            if (isExist != null)
            {
                throw new CustomException(HttpStatusCode.BadRequest, "This promotion is active");
            }
            Promotion promotion = new Promotion()
            {
                Code           = promotionRequest.Code,
                DiscountAmount = promotionRequest.DiscountAmount,
                ExpiredDate    = promotionRequest.ExpiredDate,
                IsActive       = promotionRequest.IsActive,
            };

            dbContext.Add(promotion);
            var isSuccess = dbContext.SaveChanges();

            if (isSuccess <= 0)
            {
                throw new CustomException(HttpStatusCode.BadRequest, "Something went wrong when save this promotion");
            }
            return(new PromotionDTO(promotion));
        }
        public void btnAddPost_Click(object sender, EventArgs e)
        {
            PromotionRequest promotion = new PromotionRequest();
            StringBuilder    html;


            if (tbAddNumber.Text.Length > 0)
            {
                html = new StringBuilder(String.Format("<p id=\"SecurityCode\">{0}</p>", tbAddNumber.Text));

                //
                // Create the new promotion.
                //
                if (CampusID != -1)
                {
                    promotion.Campus = new Arena.Organization.Campus(CampusID);
                }
                promotion.ContactName     = ArenaContext.Current.Person.FullName;
                promotion.ContactEmail    = "";
                promotion.ContactPhone    = "";
                promotion.Title           = "Generic Number";
                promotion.TopicArea       = new Lookup(TopicAreaID);
                promotion.WebSummary      = html.ToString();
                promotion.WebPromote      = true;
                promotion.WebStartDate    = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);
                promotion.WebEndDate      = promotion.WebStartDate.AddYears(1);
                promotion.WebApprovedBy   = ArenaContext.Current.User.Identity.Name;
                promotion.WebApprovedDate = DateTime.Now;
                promotion.Save(ArenaContext.Current.User.Identity.Name);
            }

            dgNote_ReBind(null, null);
        }
        public IActionResult PromoteStudent(PromotionRequest promotionRequest)
        {
            var errors = ValidationHelper.ValidatePromotionRequest(promotionRequest);

            if (!errors.Count.Equals(0))
            {
                return(StatusCode(400, errors));
            }

            bool studyExists = _enrollmentDbService.StudyExists(promotionRequest.Studies);

            if (!studyExists)
            {
                return(NotFound("Studies " + promotionRequest.Studies + " does not exist"));
            }

            var enrollmentExists = _enrollmentDbService.EnrollmentExists(promotionRequest.Semester, promotionRequest.Studies);

            if (!enrollmentExists)
            {
                return(NotFound("Enrollment for semester " + promotionRequest.Semester + " for " + promotionRequest.Studies + " does not exist"));
            }

            var studentForPromotion = _enrollmentDbService.GetStudentOnEnrollment(promotionRequest.Semester, promotionRequest.Studies);

            if (!studentForPromotion.Any())
            {
                return(StatusCode(404, "No students on semester " + promotionRequest.Semester + " and with studies " + promotionRequest.Studies));
            }

            var responses = _enrollmentDbService.PromoteStudents(promotionRequest, studentForPromotion);

            return(StatusCode(201, responses));
        }
示例#5
0
        // edit promotion voor ingelogde merchant zijn establishment
        public async Task <(string, bool)> EditPromotion(int promotionId, PromotionRequest editPromotionRequest)
        {
            string message;
            bool   isSuccess = false;

            var editedPromotionJson = JsonConvert.SerializeObject(editPromotionRequest);

            var credentials = passwordVault.Retrieve("Stapp", "Token");

            credentials.RetrievePassword();
            client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", credentials.Password);

            try
            {
                var res = await client.PutAsync(new Uri($"{baseUrl}api/event/{promotionId}"), new StringContent(editedPromotionJson, System.Text.Encoding.UTF8, "application/json"));

                if (res.StatusCode != System.Net.HttpStatusCode.OK)
                {
                    message = JsonConvert.DeserializeObject <ErrorMessage>(await res.Content.ReadAsStringAsync()).Error;
                }
                else
                {
                    message   = JsonConvert.DeserializeObject <SuccesMessage>(await res.Content.ReadAsStringAsync()).Bericht;
                    isSuccess = true;
                }
            }
            catch (Exception e)
            {
                message = e.Message;
            }

            return(message, isSuccess);
        }
示例#6
0
        public PromotionRequest GetPromotions(ApplicationUser user)
        {
            PromotionRequest response = new PromotionRequest();
            Driver           driver   = carpoolDb.Drivers.FirstOrDefault(c => c.ApplicationUserId.Equals(user.Id));

            if (driver != null)
            {
                Promotion promotion = carpoolDb.Promotions.FirstOrDefault(c => c.Id.Equals(driver.PromotionId));
                if (promotion != null)
                {
                    response = new PromotionRequest()
                    {
                        Discount = Convert.ToString(promotion.Discount * 100),
                        Distance = Convert.ToString(promotion.Distance)
                    };
                }
                else
                {
                    response = new PromotionRequest()
                    {
                        Discount = "0",
                        Distance = "0"
                    };
                }
            }
            else
            {
                response = new PromotionRequest()
                {
                    Discount = "0",
                    Distance = "0"
                };
            }
            return(response);
        }
        /// <summary>
        /// Load the promotion into memory either from the information on the URL or the session data.
        /// </summary>
        protected void LoadRequest()
        {
            //
            // Pull it from the session data if this is a postback event.
            //
            if (IsPostBack)
            {
                promotion = (PromotionRequest)Session["HDC_PROMOTION"];
            }

            if (promotion == null)
            {
                //
                // Grab it from the query string, or create a new one.
                //
                if (!String.IsNullOrEmpty(Request.QueryString["REQUEST"]))
                {
                    promotion = new PromotionRequest(Convert.ToInt32(Request.QueryString["REQUEST"]));
                }
                else
                {
                    promotion = new PromotionRequest();
                }

                //
                // Store it in the session data for later.
                //
                Session["HDC_PROMOTION"] = promotion;
            }
        }
        public PromotionResponse PromoteStudents(PromotionRequest request)
        {
            PromotionResponse response;

            using (var connection = new SqlConnection(SqlServerDb.connectionString))
            {
                using (var command = new SqlCommand())
                {
                    command.Connection = connection;

                    command.CommandText = "PromoteStudents";
                    command.CommandType = CommandType.StoredProcedure;
                    command.Parameters.AddWithValue("@studies", request.Studies);
                    command.Parameters.AddWithValue("@semester", request.Semester);
                    connection.Open();
                    command.ExecuteNonQuery();

                    response = new PromotionResponse
                    {
                        Studies  = request.Studies,
                        Semester = request.Semester + 1
                    };
                }
            }

            return(response);
        }
        private XmlDocument BuildXMLForPromotion()
        {
            // Create an empty XML doc to hold our xml output
            XmlDocument document = null;

            document = new XmlDocument();
            XmlNode rootNode = document.CreateNode(XmlNodeType.Element, "promotion", document.NamespaceURI);

            document.AppendChild(rootNode);

            PromotionRequest item     = new PromotionRequest(PromotionIDSetting);
            XmlNode          itemNode = document.CreateNode(XmlNodeType.Element, "item", document.NamespaceURI);

            rootNode.AppendChild(itemNode);

            XmlAttribute itemAttrib = document.CreateAttribute("tmp");

            SetNodeAttribute(document, itemNode, itemAttrib, "id", item.PromotionRequestID.ToString());
            SetNodeAttribute(document, itemNode, itemAttrib, "title", item.Title);
            SetNodeAttribute(document, itemNode, itemAttrib, "summary", item.WebSummary);
            SetNodeAttribute(document, itemNode, itemAttrib, "details", item.WebText);
            SetNodeAttribute(document, itemNode, itemAttrib, "summaryImageUrl", String.Format("CachedBlob.aspx?guid={0}", item.WebSummaryImageBlob.GUID.ToString()));
            SetNodeAttribute(document, itemNode, itemAttrib, "detailsImageUrl", String.Format("CachedBlob.aspx?guid={0}", item.WebImageBlob.GUID.ToString()));

            return(document);
        }
        public void dgNote_Delete(object sender, DataGridCommandEventArgs e)
        {
            DataBoundLiteralControl lb        = (DataBoundLiteralControl)e.Item.Cells[0].Controls[3].Controls[0];
            PromotionRequest        promotion = new PromotionRequest(Convert.ToInt32(lb.Text));

            promotion.Delete();

            dgNote_ReBind(null, null);
        }
示例#11
0
        public IActionResult StudentPromotions(PromotionRequest promotionRequest)
        {
            if (promotionRequest.Studies == null || promotionRequest.Semester == null || promotionRequest.Semester < 1)
            {
                return(NotFound("Nie pełne dane"));
            }


            var com = new SqlCommand()
            {
                CommandText = "SELECT s.IdStudy FROM Studies s WHERE s.Name = @studyName"
            };

            com.Parameters.AddWithValue("studyName", promotionRequest.Studies);

            var result1 = dbservice.ExecuteSelect(com);
            int idStudy;

            if (result1.Count == 0)
            {
                return(BadRequest("Nie znaleziono kierunku"));
            }
            else
            {
                idStudy = (int)result1[0][0];
            }

            com = new SqlCommand()
            {
                CommandText = "SELECT * FROM Enrollment e WHERE e.Semester = @semester and e.IdStudy = @idStudy"
            };
            com.Parameters.AddWithValue("semester", promotionRequest.Semester);
            com.Parameters.AddWithValue("idStudy", idStudy);

            var result2 = dbservice.ExecuteSelect(com);

            if (result2.Count != 0)
            {
                com = new SqlCommand()
                {
                    CommandText = "procedurePromoteStudents",
                    CommandType = CommandType.StoredProcedure,
                };

                com.Parameters.AddWithValue("semester", promotionRequest.Semester);
                com.Parameters.AddWithValue("idStudy", idStudy);

                dbservice.ExecuteInsert(com);

                return(Ok());
            }
            else
            {
                return(NotFound("Brak takich wpisow"));
            }
        }
示例#12
0
        public IActionResult PostPromoteStudent([FromBody] PromotionRequest p)
        {
            Enrollment e = _dbService.PostPromoteStudents(p);

            if (e == null)
            {
                return(BadRequest("X"));
            }
            return(Created("", e));
        }
示例#13
0
        public IActionResult PromoteStudents([FromBody] PromotionRequest request)
        {
            Enrollment result = _dbService.PromoteStudents(request.semester, request.studies);

            if (result == null)
            {
                return(NotFound());
            }
            return(Created("", result));
        }
        public ActionResult PromoteStudents([FromBody] PromotionRequest request)
        {
            var enrollment = _service.PromoteStudents(request);

            if (enrollment == null)
            {
                return(NotFound("Enrollment not found!"));
            }
            return(Created("localhost", enrollment));
        }
        public IActionResult PromoteStudents(PromotionRequest request)
        {
            var enrollment = _service.PromoteStudents(request);

            if (enrollment == null)
            {
                return(BadRequest("400 Bad Request Error!"));
            }
            return(CreatedAtAction(nameof(EnrollStudent), enrollment));
        }
示例#16
0
 protected string GetDetailsUrl(PromotionRequest promotion)
 {
     if (promotion.WebExternalLink != string.Empty)
     {
         return(promotion.WebExternalLink);
     }
     else
     {
         return(String.Format("Default.aspx?page={0}&promotionId={1}", PromotionDisplayPageIDSetting, promotion.PromotionRequestID));
     }
 }
        public IEnumerable <Promotion> GetPromotion(PromotionRequest req)
        {
            var pService   = UoW.Service <IPromotionService>();
            var promotions = pService.GetActive();

            if (req.Code != null)
            {
                promotions = promotions.Where(p => p.Code == req.Code);
            }
            return(promotions);
        }
        protected string GetImageUrl(PromotionRequest promotion)
        {
            PromotionRequestDocument doc = promotion.Documents.GetFirstByType(int.Parse(ThumbnailSetting));

            if (doc != null)
            {
                return(String.Format("CachedBlob.aspx?guid={0}&width={1}&height={2}", doc.GUID,
                                     WidthSetting, HeightSetting));
            }

            return(string.Empty);
        }
        /// <summary>
        /// Build and send the XML response for this request. The HTTP request is terminated
        /// at the end of this function so no further data can be sent.
        /// </summary>
        /// <param name="promotionID">The ID of the promotion being requested.</param>
        /// <param name="index">The numerical index of the Document/Image being requested.</param>
        private void SendDisplayXML(int promotionID, int index)
        {
            PromotionRequest promotion = new PromotionRequest(promotionID);
            StringBuilder    sb        = new StringBuilder();
            StringWriter     writer    = new StringWriter(sb);
            XmlDocument      xdoc      = new XmlDocument();
            XmlDeclaration   dec;
            XmlNode          root, node;


            //
            // Setup the basic XML document.
            //
            dec = xdoc.CreateXmlDeclaration("1.0", "utf-8", null);
            xdoc.InsertBefore(dec, xdoc.DocumentElement);
            root = xdoc.CreateElement("Display");

            //
            // Determine if we have a valid existing promotion to work with.
            //
            if (promotion.PromotionRequestID != -1)
            {
                //
                // We do, so store the promotion and the requested image.
                //
                node = xdoc.CreateElement("ID");
                node.AppendChild(xdoc.CreateTextNode(String.Format("{0},{1}", promotion.PromotionRequestID.ToString(), index.ToString())));
                root.AppendChild(node);

                node = xdoc.CreateElement("URL");
                node.AppendChild(xdoc.CreateTextNode(String.Format("CachedBlob.aspx?guid={0}", promotion.Documents[index].GUID.ToString())));
                root.AppendChild(node);
            }
            else
            {
                //
                // No, send back a blank response.
                //
                node = xdoc.CreateElement("ID");
                node.AppendChild(xdoc.CreateTextNode(""));
                root.AppendChild(node);
            }

            xdoc.AppendChild(root);

            //
            // Send the XML stream. The End() forces .NET to send the data and close
            // out the connection cleanly.
            //
            xdoc.Save(writer);
            Response.Write(sb.ToString());
            Response.End();
        }
示例#20
0
        public void btnNumberBoard_Click(object sender, CommandEventArgs e)
        {
            OccurrenceAttendance oa = new OccurrenceAttendance(Convert.ToInt32(e.CommandArgument));

            Arena.DataLayer.Organization.OrganizationData org = new Arena.DataLayer.Organization.OrganizationData();
            String securityNumber = oa.SecurityCode.Substring(2);
            int    promotionRequestID;


            //
            // Check if the security code is already posted.
            //
            promotionRequestID = FindPromotionRequest(oa.OccurrenceAttendanceID);
            if (promotionRequestID != -1)
            {
                PromotionRequest promotion = new PromotionRequest(promotionRequestID);

                promotion.Delete();
            }
            else
            {
                PromotionRequest promotion = new PromotionRequest();
                String           html;

                //
                // Generate the HTML for this note.
                //
                html = String.Format("<p id=\"SecurityCode\">{0}</p>", securityNumber);

                //
                // Create the new promotion.
                //
                if (CampusID != -1)
                {
                    promotion.Campus = new Campus(CampusID);
                }
                promotion.ContactName     = ArenaContext.Current.Person.FullName;
                promotion.ContactEmail    = "";
                promotion.ContactPhone    = "";
                promotion.Title           = oa.OccurrenceAttendanceID.ToString();
                promotion.TopicArea       = new Lookup(TopicAreaID);
                promotion.WebSummary      = html;
                promotion.WebPromote      = true;
                promotion.WebStartDate    = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);
                promotion.WebEndDate      = promotion.WebStartDate.AddYears(1);
                promotion.WebApprovedBy   = ArenaContext.Current.User.Identity.Name;
                promotion.WebApprovedDate = DateTime.Now;
                promotion.Save(ArenaContext.Current.User.Identity.Name);
            }

            dgAttendance_ReBind(null, null);
        }
        public async Task <IActionResult> CreateAddress([FromBody] PromotionRequest request)
        {
            var Promotion = _mapper.Map <Promotion>(request);

            var created = await _PromotionService.CreatePromotionAsync(Promotion);

            if (!created)
            {
                return(BadRequest(new { error = "Unable to create Promotion" }));
            }

            return(CreatedAtRoute(nameof(GetPromotionById), new { Id = Promotion.Id }, _mapper.Map <PromotionResponse>(Promotion)));
        }
        public IActionResult PromoteStudent(PromotionRequest request)
        {
            return(Ok(_idbService.PromoteStudents(request)));


            /* PromoteStudentRes response;
             * using (var connection = new SqlConnection(DbConnection.connectionString))
             * {
             *   using (var command = new SqlCommand())9u
             *   {
             *
             *       command.Connection = connection;
             *       // var transaction = connection.BeginTransaction();
             *       // command.Transaction = transaction;
             *
             *       command.CommandText = "PromoteStudents";
             *       command.CommandType = CommandType.StoredProcedure;
             *       command.Parameters.AddWithValue("@studies", request.Studies);
             *       command.Parameters.AddWithValue("@semester", request.Semester);
             *       connection.Open();
             *       command.ExecuteNonQuery();
             *
             *       response = new PromoteStudentRes
             *       {
             *           Studies = request.Studies,
             *           Semester = request.Semester + 1
             *       };
             *
             *//*command.CommandText = @"SELECT IdStudy FROM Studies WHERE Name=@study;";
             *       command.Parameters.AddWithValue("study", request.Studies);
             *       var dataReader1 = command.ExecuteReader();
             *       if (!dataReader1.Read())
             *       {
             *           return NotFound("This study field does not exist.");
             *       }
             *       int _idStudy = int.Parse(dataReader1["IdStudy"].ToString());
             *
             *       command.CommandText = @"SELECT IdEnrollment FROM Enrollment WHERE Semester=@semester AND IdStudy=@idStudy;";
             *       command.Parameters.AddWithValue("semester", request.Semester);
             *       command.Parameters.AddWithValue("idStudy", _idStudy);
             *       var dataReader2 = command.ExecuteReader();
             *       if (!dataReader2.Read())
             *       {
             *           return NotFound($"Requested study with semester {request.Semester} does not exist!");
             *       }
             *       int _idEnrollment = int.Parse(dataReader2["IdEnrollment"].ToString());*//*
             *   }
             * }
             *
             * return Ok($"Students of {response.Studies} studies have been promoted to semester {response.Semester}!");*/
        }
示例#23
0
        public IActionResult PromoteStudents(PromotionRequest request)
        {
            var response = _dbService.PromoteStudents(request);

            switch (response.Type)
            {
            case "Ok": return(Ok(response.ResponseObject));

            case "BadRequest": return(BadRequest(response.Message));

            case "NotFound": return(NotFound(response.Message));

            default: return(Problem(response.Message));
            }
        }
示例#24
0
        private void SendDisplayData(int promotionID)
        {
            PromotionRequest promotion = new PromotionRequest(promotionID);


            if (promotion.PromotionRequestID != -1)
            {
                Response.Write(promotion.WebSummary);
            }

            //
            // The End() forces .NET to send the data and close out the connection cleanly.
            //
            Response.End();
        }
        public async Task <IActionResult> UpdateAddress(int Id, PromotionRequest request)
        {
            var Promotion = await _PromotionService.GetPromotionByIdAsync(Id);

            if (Promotion == null)
            {
                return(NotFound());
            }

            _mapper.Map(request, Promotion);

            _PromotionService.UpdatePromotionAsync(Promotion);

            await _PromotionService.SaveChangesAsync();

            return(Ok(_mapper.Map <PromotionResponse>(Promotion)));
        }
        public List <PromotionResponse> PromoteStudents(PromotionRequest promotionRequest, IEnumerable <Student> students)
        {
            var studyId = GetStudyId(promotionRequest.Studies);
            var futureEnrollmentIdExists = _context.Enrollment
                                           .Any(enrollment =>
                                                enrollment.Semester == (promotionRequest.Semester + 1) && enrollment.IdStudy == studyId);

            var futureEnrollmentId = 0;

            if (!futureEnrollmentIdExists)
            {
                futureEnrollmentId = CreateNewEnrollmentForNextSemester(studyId, promotionRequest.Semester);
            }
            else
            {
                futureEnrollmentId = _context.Enrollment
                                     .FirstOrDefault(enrollment =>
                                                     enrollment.Semester == (promotionRequest.Semester + 1) && enrollment.IdStudy == studyId)
                                     .IdEnrollment;
            }

            var studentsList = students.ToList();

            studentsList.ForEach(student =>
            {
                student.IdEnrollment = futureEnrollmentId;
            });
            _context.SaveChanges();

            return(studentsList.Select(student => new PromotionResponse()
            {
                IdEnrollment = futureEnrollmentId,
                Semester = promotionRequest.Semester + 1,
                Student = new Student()
                {
                    IndexNumber = student.IndexNumber,
                    FirstName = student.FirstName,
                    LastName = student.LastName,
                    BirthDate = student.BirthDate,
                    Password = student.Password,
                    IdEnrollment = student.IdEnrollment
                }
            })
                   .ToList());
        }
示例#27
0
        public IActionResult StudentPromotions(PromotionRequest promotionRequest)
        {
            var command = new SqlCommand()
            {
                CommandText = "SELECT s.IdStudy FROM Studies s WHERE s.Name = @studyName"
            };

            command.Parameters.AddWithValue("studyName", promotionRequest.Studies);
            var queryResult = dbService.ExecuteSelect(command);
            int idStudy;

            if (queryResult.Count == 0)
            {
                return(BadRequest("not studies found"));
            }
            else
            {
                idStudy = (int)queryResult[0][0];
            }

            command = new SqlCommand()
            {
                CommandText = "SELECT * FROM Enrollment e WHERE e.Semester = @semester and e.IdStudy = @idStudy"
            };
            command.Parameters.AddWithValue("semester", promotionRequest.Semester);
            command.Parameters.AddWithValue("idStudy", idStudy);

            queryResult = dbService.ExecuteSelect(command);
            if (queryResult.Count == 0)
            {
                return(NotFound("No entries"));
            }
            else
            {
                command = new SqlCommand()
                {
                    CommandText = "procedurePromoteStudents",
                    CommandType = System.Data.CommandType.StoredProcedure
                };
                command.Parameters.AddWithValue("semester", promotionRequest.Semester);
                command.Parameters.AddWithValue("idStudy", idStudy);
                dbService.ExecuteInsert(command);
                return(Ok());
            }
        }
 public HttpResponseMessage Get([FromUri] PromotionRequest req)
 {
     try
     {
         var iDomain     = new InformationDomain();
         var promotion   = iDomain.GetPromotion(req);
         var promotionVM = MapToPromotionViewModel(promotion.ToList());
         return(Http.OkBase(promotionVM, Message.Success));
     }
     catch (ErrorMessage e)
     {
         return(Http.ErrorBase(null, Message.GetError(e)));
     }
     catch (Exception e)
     {
         return(Http.ErrorBase(null, Message.GetError(e)));
     }
 }
示例#29
0
        //PROMOTING STUDENTS


        public Models.Enrollment PromoteStudents(PromotionRequest request)
        {
            using (var connection = new SqlConnection(_databaseString))
            {
                connection.Open();
                var transaction  = connection.BeginTransaction();
                var idEnrollment = getEnrollmentIdBySemester(request, connection, transaction);
                if (idEnrollment == -1)
                {
                    return(null);
                }
                promote(connection, transaction, request.Studies, request.Semester);
                Models.Enrollment enrollment = new Models.Enrollment();
                enrollment.Studies  = request.Studies;
                enrollment.Semester = request.Semester + 1;
                return(enrollment);
            }
        }
        public IActionResult UpdatePromotion(PromotionRequest model)
        {
            string           email            = User.FindFirst(ClaimTypes.NameIdentifier)?.Value;
            ApplicationUser  user             = context.ApplicationUsers.FirstOrDefault(c => c.Email.Equals(email));
            PromotionRequest updatedPromotion = IDriverService.UpdatePromotion(model, user);

            if (updatedPromotion != null)
            {
                return(Ok(new
                {
                    status = 200,
                    promotion = updatedPromotion
                }));
            }
            return(BadRequest(new
            {
                error = "Unable to update Promotion Details."
            }));
        }