예제 #1
0
        public JsonResult Action(AccomodationTypeActionModel model)
        {
            JsonResult json   = new JsonResult();
            var        result = false;

            if (model.ID > 0) //we are trying to edit a record
            {
                var accomodationType = accomodationTypesService.GetAccomodationTypeByID(model.ID);
                accomodationType.Name        = model.Name;
                accomodationType.Description = model.Description;
                result = accomodationTypesService.UpdateAccomodationType(accomodationType);
            }
            else //we are trying to create a record
            {
                AccomodationType accomodationType = new AccomodationType();
                accomodationType.Name        = model.Name;
                accomodationType.Description = model.Description;
                result = accomodationTypesService.SaveAccomodationType(accomodationType);
            }
            if (result)
            {
                json.Data = new { Success = true };
            }
            else
            {
                json.Data = new { Success = false, Message = "Unable to perform action on Accomodation Types." };
            }
            return(json);
        }
        public JsonResult Action(AccomodationTypeActionModels model)
        {
            JsonResult json   = new JsonResult();
            var        result = false;

            if (model.ID > 0)
            {
                var accomodationtype = typesService.GetAllAccomodationTypeById(model.ID);
                accomodationtype.Name        = model.Name;
                accomodationtype.Description = model.Description;
                result = typesService.UpdateAccomodationType(accomodationtype);
            }

            else
            {
                AccomodationType accomodation = new AccomodationType();
                accomodation.Name        = model.Name;
                accomodation.Description = model.Description;
                result = typesService.SaveAccomodationType(accomodation);
            }

            if (result)
            {
                json.Data = new { success = true };
            }
            else
            {
                json.Data = new { success = false, message = "unable to perform Accomodation type" };
            }
            return(json);
        }
        public JsonResult Action(AccomodationTypesActionViewModel model)
        {
            JsonResult jsonResult = new JsonResult();
            var        result     = false;

            if (model.Id > 0)
            {
                var accomodationType = accomodationTypesService.GetAccomodationTypeById(model.Id);

                accomodationType.Name        = model.Name;
                accomodationType.Description = model.Description;

                result = accomodationTypesService.UpdateAccomodationType(accomodationType);
            }
            else
            {
                AccomodationType newRecord = new AccomodationType();

                newRecord.Name        = model.Name;
                newRecord.Description = model.Description;

                result = accomodationTypesService.SaveAccomodationType(newRecord);
            }

            if (result)
            {
                jsonResult.Data = new { Success = true };
            }
            else
            {
                jsonResult.Data = new { Success = false, Message = "Unable to perform action on  Accomodation Type!!!" };
            }

            return(jsonResult);
        }
예제 #4
0
        public JsonResult Action(AccomodationTypesActionModel model)
        {
            JsonResult json = new JsonResult();

            AccomodationType accomodationType = new AccomodationType();

            accomodationType.Name        = model.Name;
            accomodationType.Description = model.Description;

            var result = accomodationTypesService.SaveAccomodationType(accomodationType);

            if (result)
            {
                json.Data = new { Success = true };
            }
            else
            {
                json.Data = new { Success = false, Message = "Unable to add Accomodation Type." };
            }
            return(json);
        }
예제 #5
0
        public JsonResult Action(AccomodationTypeActionViewModel modal)
        {
            JsonResult Json   = new JsonResult();
            var        result = false;
            AccomodationTypesService objAccomodationTypesService = new AccomodationTypesService();

            if (modal.Id > 0)  //we are tyring to edit
            {
                var data = objAccomodationTypesService.GeAccomodationTypeById(modal.Id);

                //    data.Id = modal.Id;

                data.Name        = modal.Name;
                data.Description = modal.Description;

                result = objAccomodationTypesService.UpdateAccomodationType(data);
            }
            else
            {
                accomodationType.Name        = modal.Name;
                accomodationType.Description = modal.Description;
                result = objAccomodationTypesService.SaveAccomodationType(accomodationType);
            }


            if (result)
            {
                Json.Data = new { Success = true };
            }
            else
            {
                Json.Data = new { Success = false, Message = "Unable to save" };
            }

            return(Json);
        }