public async Task <ActionResult> Manage(int id)
        {
            var model = new PackageHotelRoomTypeViewModel();

            if (id > 0)
            {
                var record = await this.hoteroomType.GetByIdAsync(id);

                model = this.Mapper.Map <PackageHotelRoomTypeViewModel>(record);
            }

            return(this.IsAjaxRequest()
                          ? this.View("_RoomType", model)
                          : this.View(model));
        }
        public async Task <ActionResult> Manage(PackageHotelRoomTypeViewModel model, string method)
        {
            if (this.ModelState.IsValid)
            {
                var record = this.Mapper.Map <PackageHotelRoomTypeModel>(model);
                if (model.Id == 0)
                {
                    record.SetAuditInfo(0);
                    await this.hoteroomType.InsertAsync(record);

                    if (!this.IsAjaxRequest())
                    {
                        this.ShowMessage(Messages.SavedSuccessfully);
                    }
                }
                else
                {
                    record.UpdateAuditInfo(0);
                    await this.hoteroomType.UpdateAsync(record);

                    if (!this.IsAjaxRequest())
                    {
                        this.ShowMessage(Messages.UpdateSuccessfully);
                    }
                }

                if (method == "ajax")
                {
                    return(this.Json(new { success = true, Name = model.Name, Id = record.Id }));
                }

                return(this.RedirectToRoute(Constants.RouteArea, new { controller = "hotelroomtype", action = "index", area = Constants.AreaAdmin }));
            }

            return(this.View(model));
        }