예제 #1
0
 public void Update(EventUpdateRequest myData)
 {
     DataProvider.ExecuteNonQuery("dbo.Event_Update",
                                  inputParamMapper: (SqlParameterCollection inputs) =>
     {
         inputs.Add(SqlDbParameter.Instance.BuildParameter("@organizationId", myData.OrganizationId, SqlDbType.Int));
         inputs.Add(SqlDbParameter.Instance.BuildParameter("@eventTypeId", myData.EventTypeId, SqlDbType.Int));
         inputs.Add(SqlDbParameter.Instance.BuildParameter("@title", myData.Title, SqlDbType.NVarChar, 100));
         inputs.Add(SqlDbParameter.Instance.BuildParameter("@topicDesc", myData.TopicDesc, SqlDbType.NVarChar, 2000));
         inputs.Add(SqlDbParameter.Instance.BuildParameter("@startDate", myData.StartDate, SqlDbType.Date));
         inputs.Add(SqlDbParameter.Instance.BuildParameter("@startTime", myData.StartTime, SqlDbType.Time));
         inputs.Add(SqlDbParameter.Instance.BuildParameter("@endDate", myData.EndDate, SqlDbType.Date));
         inputs.Add(SqlDbParameter.Instance.BuildParameter("@endTime", myData.EndTime, SqlDbType.Time));
         inputs.Add(SqlDbParameter.Instance.BuildParameter("@isAllDay", myData.IsAllDay, SqlDbType.Bit));
         inputs.Add(SqlDbParameter.Instance.BuildParameter("@venueName", myData.VenueName, SqlDbType.NVarChar, 100));
         inputs.Add(SqlDbParameter.Instance.BuildParameter("@addressId", myData.AddressId, SqlDbType.Int));
         inputs.Add(SqlDbParameter.Instance.BuildParameter("@scholarshipId", myData.ScholarshipId, SqlDbType.Int));
         inputs.Add(SqlDbParameter.Instance.BuildParameter("@imageUrl", myData.ImageUrl, SqlDbType.NVarChar, 128));
         inputs.Add(SqlDbParameter.Instance.BuildParameter("@contactInfo", myData.ContactInfo, SqlDbType.NVarChar, 200));
         inputs.Add(SqlDbParameter.Instance.BuildParameter("@modifiedById", myData.ModifiedById, SqlDbType.Int));
         inputs.Add(SqlDbParameter.Instance.BuildParameter("@streetAddress", myData.StreetAddress, SqlDbType.NVarChar, 150));
         inputs.Add(SqlDbParameter.Instance.BuildParameter("@city", myData.City, SqlDbType.NVarChar, 150));
         inputs.Add(SqlDbParameter.Instance.BuildParameter("@stateProvinceId", myData.StateProvinceId, SqlDbType.Int));
         inputs.Add(SqlDbParameter.Instance.BuildParameter("@postalCode", myData.PostalCode, SqlDbType.NVarChar, 20));
         inputs.Add(SqlDbParameter.Instance.BuildParameter("@Id", myData.Id, SqlDbType.Int));
     });
 }
예제 #2
0
        public HttpResponseMessage Update(int id, EventUpdateRequest updateModel)
        {
            if (updateModel == null)
            {
                return(Request.CreateErrorResponse(
                           HttpStatusCode.NotAcceptable,
                           "No data was sent to the server."));
            }
            ;

            if (updateModel.Id != id)
            {
                return(Request.CreateErrorResponse(
                           HttpStatusCode.NotAcceptable,
                           "The Id on the URL and data body does not match."));
            }
            ;

            if (!ModelState.IsValid)
            {
                return(Request.CreateErrorResponse(
                           HttpStatusCode.BadRequest,
                           ModelState));
            }
            ;

            eventsService.Update(updateModel);
            SuccessResponse successResponse = new SuccessResponse();

            return(Request.CreateResponse(HttpStatusCode.OK, successResponse));
        }
예제 #3
0
        public IHttpActionResult Put(EventUpdateRequest model)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(BadRequest(ModelState));
                }

                _eventService.Put(model);

                return(Ok(new SuccessResponse()));
            }
            catch (Exception ex)
            {
                _errorLogService.Post(new Models.Requests.Logs.ErrorLogAddRequest
                {
                    ErrorSourceTypeId = 1,
                    Message           = ex.Message,
                    StackTrace        = ex.StackTrace,
                    Title             = "Error in " + GetType().Name + " " + System.Reflection.MethodBase.GetCurrentMethod().Name
                });
                return(BadRequest(ex.Message));
            }
        }
예제 #4
0
        public async Task <IActionResult> EventSave(EventVM model, IFormFile image)
        {
            String fileName = new String("");

            if (image != null && image.Length > 0)
            {
                fileName = Path.GetFileName(image.FileName);
                //var mappedPath = HttpContext.GetServerVariable.MapPath("~/Content/Images/");
                var path = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot\\images\\items", fileName);
                using (var fajlSteam = new FileStream(path, FileMode.Create))
                {
                    await image.CopyToAsync(fajlSteam);
                }
            }

            if (model.ID == 0)
            {
                var insertRequest = new EventInsertRequest()
                {
                    Name          = model.Name,
                    Description   = model.Description,
                    EventCategory = model.EventCategory,
                    Start         = model.Start,
                    End           = model.Start,
                    IsApproved    = model.IsApproved,
                    IsCanceled    = model.IsCanceled,
                    OrganizerID   = model.OrganizerID,
                    VenueID       = model.VenueID,
                    Image         = fileName
                };

                await _eventiApi.CreateEventAsync(insertRequest);
            }
            else
            {
                var updateRequest = new EventUpdateRequest()
                {
                    Name            = model.Name,
                    Description     = model.Description,
                    EventCategory   = model.EventCategory,
                    Start           = model.Start,
                    End             = model.Start,
                    IsApproved      = model.IsApproved,
                    IsCanceled      = model.IsCanceled,
                    OrganizerID     = model.OrganizerID,
                    AdministratorID = model.AdministratorID,
                    VenueID         = model.VenueID,
                    Image           = fileName
                };

                await _eventiApi.UpdateEventAsync(model.ID, updateRequest);
            }

            return(Redirect("Index"));
        }
예제 #5
0
        public void Update(EventUpdateRequest model, int userId)
        {
            string procName = "[dbo].[Events_Update]";

            _dataProvider.ExecuteNonQuery(procName,
                                          inputParamMapper : delegate(SqlParameterCollection col)
            {
                col.AddWithValue("@ModifiedBy", userId);
                col.AddWithValue("@Id", model.Id);
                AddCommonParams(model, col);
            },
                                          returnParameters: null);
        }
예제 #6
0
 public void Update(EventUpdateRequest req)
 {
     using (var con = GetConnection())
     {
         var cmd = con.CreateCommand();
         cmd.CommandText = "Events_Update";
         cmd.CommandType = CommandType.StoredProcedure;
         cmd.Parameters.AddWithValue("Id", req.id);
         cmd.Parameters.AddWithValue("EventName", req.eventName);
         cmd.Parameters.AddWithValue("State", req.state);
         cmd.Parameters.AddWithValue("ImageUrl", req.imageUrl);
         cmd.ExecuteNonQuery();
     }
 }
예제 #7
0
        public async Task <IActionResult> UpdateEvent(EventUpdateRequest request)
        {
            var evnt = await _eventService.GetById(request.Id);

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

            evnt.Update(request);

            await _eventService.Update(evnt);

            return(Ok());
        }
예제 #8
0
        public HttpResponseMessage Update(EventUpdateRequest req)
        {
            if (req == null)
            {
                ModelState.AddModelError("", "no data");
            }

            if (!ModelState.IsValid)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState));
            }

            letsGoService.Update(req);
            return(Request.CreateResponse(HttpStatusCode.OK));
        }
예제 #9
0
        public ActionResult <ItemResponse <int> > Update(EventUpdateRequest model)
        {
            int          code     = 200;
            BaseResponse response = null;

            try
            {
                int userId = _authService.GetCurrentUserId();
                _service.Update(model, userId);
                response = new SuccessResponse();
            }
            catch (Exception ex)
            {
                code = 500;
                Logger.LogError(ex.ToString());
                response = new ErrorResponse($"Generic Error: {ex.Message}");
            }

            return(StatusCode(code, response));
        }
예제 #10
0
        public async Task <IActionResult> EditEventSave(EventEditVM model)
        {
            var response = await _eventiApi.GetEventAsync(model.ID);

            var e = response.Content;

            var request = new EventUpdateRequest()
            {
                Name          = model.Name,
                Description   = model.Description,
                Start         = model.Start,
                End           = model.End,
                EventCategory = (EventCategory)model.EventCategorySelected
            };

            await _eventiApi.UpdateEventAsync(model.ID, request);


            return(Redirect("EventInfoPrikaz?EventID=" + model.ID.ToString()));
        }
예제 #11
0
 public void Update(EventUpdateRequest updateModel)
 {
     dataProvider.ExecuteNonQuery(
         "Events_Update",
         inputParamMapper: parameters =>
     {
         parameters.AddWithValue("@Id", updateModel.Id);
         parameters.AddWithValue("@Name", updateModel.Name);
         parameters.AddWithValue("@StartDate", updateModel.StartDate ?? (object)DBNull.Value);
         parameters.AddWithValue("@EndDate", updateModel.EndDate ?? (object)DBNull.Value);
         parameters.AddWithValue("@Description", updateModel.Description);
         parameters.AddWithValue("@Logo", updateModel.Logo);
         parameters.AddWithValue("@Link", updateModel.Link);
         parameters.AddWithValue("@IsOngoing", updateModel.IsOngoing);
         parameters.AddWithValue("@Organizer", updateModel.Organizer);
         parameters.AddWithValue("@CreatedBy", updateModel.CreatedBy);
         parameters.AddWithValue("@ModifiedBy", updateModel.ModifiedBy);
         parameters.AddWithValue("@Private", updateModel.Private);
     },
         returnParameters: null);
 }
예제 #12
0
        /// <summary>
        /// Обновить
        /// </summary>
        /// <param name="request"></param>
        public void Update(EventUpdateRequest request)
        {
            if (request == null)
            {
                return;
            }

            Title       = request.Title;
            Description = request.Description;
            AccessType  = request.AccessType;
            StartDate   = request.StartDate;
            EndDate     = request.EndDate;
            //RegionId = request.RegionId;
            Price = request.Price;
            Lat   = request.Lat;
            Lon   = request.Lon;
            Type  = request.EventType;

            ChangeDate = DateTime.UtcNow;

            // TODO:
        }
예제 #13
0
        public IHttpActionResult Put(EventUpdateRequest data)
        {
            try
            {
                data.ModifiedById = _userService.GetCurrentUserId();
                _Service.Update(data);
                return(Ok(new SuccessResponse()));
            }
            catch (Exception ex)
            {
                int currentUser = _userService.GetCurrentUserId();
                _appLogService.Insert(new AppLogAddRequest
                {
                    AppLogTypeId = 1,
                    Message      = ex.Message,
                    StackTrace   = ex.StackTrace,
                    Title        = "Error in " + GetType().Name + " " + System.Reflection.MethodBase.GetCurrentMethod().Name,
                    UserBaseId   = currentUser
                });

                return(BadRequest(ex.Message));
            }
        }