public ActionResult Save(SegmentViewModel data)
        {
            string     username = User.Identity.GetUserName();
            CommonView model    = new CommonView();

            try
            {
                if (data.ID == 0)
                {
                    SegmentViewModel segment = new SegmentViewModel();
                    //add
                    data.CreatedBy   = username;
                    data.DateCreated = DateTime.Now;

                    segment = _segmentService.Create(data);
                    if (segment.ID > 0)
                    {
                        model.Message = "Data added.";
                    }
                }
                else
                {
                    //update
                    data.DateModified = DateTime.Now;
                    data.ModifiedBy   = username;

                    _segmentService.Update(data);

                    model.Message = "Data updated.";
                }
            }
            catch (Exception ex)
            {
                if (ex.GetType() == typeof(ArgumentException))
                {
                    model.Message = ((ArgumentException)ex).Message;
                }
                else
                {
                    model.Message = "Unable to save data. Please contact your system administrator.";
                }
            }


            return(Json(model, JsonRequestBehavior.AllowGet));
        }
 public async Task <OperationResult> Create([FromBody] SegmentModel createModel)
 {
     return(await _segmentService.Create(createModel));
 }
 public void CreateDiscountTicket(int theaterId, int projectionId, [FromBody] DiscountTicketBindingModel seat)
 {
     _segmentService.Create(projectionId, seat);
 }
 public void CreateVIPSeat(int theaterId, int projectionId, [FromBody] VIPSeatBindingModel seat)
 {
     _segmentService.Create(projectionId, seat);
 }