Exemple #1
0
        public ActionResult UpdateTicket(int CategoryId, string CategoryName, decimal CategoryPrice, string RecordStatus)
        {
            try
            {
                _TicketingCategoryRepo = new GenericRepository <TicketingCategory>(_unitOfWork);

                //duplicate check

                var items = _TicketingCategoryRepo.Repository.GetAll(x => x.CategoryName.Trim().ToLower().Equals(CategoryName.Trim().ToLower()));

                if (items.Count > 0)
                {
                    return(Json(new { Success = false, RetMessage = "Record Already Exist." }, JsonRequestBehavior.AllowGet));
                }

                if (CategoryId > 0)
                {
                    var obj = _TicketingCategoryRepo.Repository.Get(x => x.CategoryId == CategoryId);
                    obj.CategoryName  = CategoryName;
                    obj.CategoryPrice = CategoryPrice;
                    obj.RecordStatus  = RecordStatus;
                    obj.ModifiedDatet = DateTime.Now;
                    _TicketingCategoryRepo.Repository.Update(obj);
                    return(Json(new { Success = true, RetMessage = "Record Updated Successsfully." }, JsonRequestBehavior.AllowGet));
                }
                else
                {
                    var obj = new TicketingCategory();
                    obj.CategoryName  = CategoryName;
                    obj.CategoryPrice = CategoryPrice;
                    obj.RecordStatus  = RecordStatus;
                    obj.CreatedDate   = DateTime.Now;
                    obj.ModifiedDatet = DateTime.Now;
                    _TicketingCategoryRepo.Repository.Add(obj);
                    return(Json(new { Success = true, RetMessage = "Record Added Successsfully." }, JsonRequestBehavior.AllowGet));
                }
            }
            catch (Exception ex)
            {
                return(Json(new { Success = false, RetMessage = ex.Message }, JsonRequestBehavior.AllowGet));
            }
        }
Exemple #2
0
        public HttpResponseMessage GetTicketingCategoryByEventID(int eventID)
        {
            List <Musika.Models.TicketingCategory> lstTicketingCategory = new List <Musika.Models.TicketingCategory>();
            DataSet ds = new Musika.Repository.SPRepository.SpRepository().GetTicketCategoryListByEventId(eventID);

            if (ds.Tables[0].Rows.Count > 0)
            {
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    DataRow dr = ds.Tables[0].Rows[i];

                    TicketingCategory model = new TicketingCategory();
                    model.CategoryName = Convert.ToString(dr[1].ToString());
                    lstTicketingCategory.Add(model);
                }

                return(Request.CreateResponse(HttpStatusCode.OK, JsonResponse.GetResponse(ResponseCode.Success, lstTicketingCategory.OrderByDescending(p => p.CategoryName))));
            }
            else
            {
                return(Request.CreateResponse(HttpStatusCode.OK, JsonResponse.GetResponse(ResponseCode.Failure, null)));
            }
        }