public async Task <IActionResult> Delete(RequestDataModel request) { var settings = new JsonSerializerSettings(); var searchObject = new CategoryModel { }; settings.DateFormatString = "dd/MM/yyyy"; searchObject = JsonConvert.DeserializeObject <CategoryModel>(request.model, settings); var category = new CategoryModel(); category = searchObject; category.LastModifyDate = DateTime.Now; var hostAPI = "https://localhost:44322"; var rs = await ApiProvider.PostAsync <int>(hostAPI, ApiConstant.DeleteCategory, category); if (rs == Constant.ReturnExcuteFunction.Success) { return(Json(new { messege = "Thành công !" })); } else { return(Json(new { messege = "Thất bại!" })); } }
public async Task <IActionResult> Delete(RequestDataModel request) { var settings = new JsonSerializerSettings(); var searchObject = new PageModel { }; settings.DateFormatString = "dd/MM/yyyy"; searchObject = JsonConvert.DeserializeObject <PageModel>(request.model, settings); var page = new PageModel(); page = searchObject; page.LastModifyDate = DateTime.Now; var hostAPI = url; var rs = await ApiProvider.PostAsync <int>(hostAPI, ApiConstant.DeletePage, page); if (rs == Constant.ReturnExcuteFunction.Success) { return(Json(new { messege = "Thành công !" })); } else { return(Json(new { messege = "Thất bại!" })); } }
public async Task <IActionResult> Index() { var grouppageModelParamater = new GroupPageModelParameter(); GroupPageReturnModel data = await ApiProvider.PostAsync <GroupPageReturnModel>(url, ApiConstant.GetDataAllGroupPage, grouppageModelParamater); ViewData["GroupPage"] = data.Data; return(View()); }
public async Task <IActionResult> GetByID(RequestDataModel request) { var settings = new JsonSerializerSettings(); var searchObject = new CategoryModel { }; settings.DateFormatString = "dd/MM/yyyy"; searchObject = JsonConvert.DeserializeObject <CategoryModel>(request.model, settings); var category = new CategoryModel(); category = searchObject; category.LastModifyDate = DateTime.Now; var hostAPI = "https://localhost:44322"; var rs = await ApiProvider.PostAsync <CategoryModel>(hostAPI, ApiConstant.GetCategoryId, category); return(Json(rs)); }
public async Task <IActionResult> GetByID(RequestDataModel request) { var settings = new JsonSerializerSettings(); var searchObject = new PageModel { }; settings.DateFormatString = "dd/MM/yyyy"; searchObject = JsonConvert.DeserializeObject <PageModel>(request.model, settings); var page = new PageModel(); page = searchObject; page.LastModifyDate = DateTime.Now; var hostAPI = url; var rs = await ApiProvider.PostAsync <PageModel>(hostAPI, ApiConstant.GetPageId, page); return(Json(rs)); }
public async Task <IActionResult> CreateOrUpdate(RequestDataModel request) { var settings = new JsonSerializerSettings(); var searchObject = new MentorModel { }; settings.DateFormatString = "dd/MM/yyyy"; string fileName = null; string orgFileName = ContentDispositionHeaderValue.Parse(request.files.ContentDisposition).FileName.Value; fileName = DateTime.Now.ToFileTime() + Path.GetExtension(orgFileName); searchObject = JsonConvert.DeserializeObject <MentorModel>(request.model, settings); var mentor = new MentorModel(); mentor = searchObject; mentor.Avatar = fileName; mentor.LastModifyDate = DateTime.Now; var hostAPI = "https://localhost:44322"; var rs = await ApiProvider.PostAsync <int>(hostAPI, ApiConstant.CreateMentor, mentor); if (rs == Constant.ReturnExcuteFunction.Success) { string fullPath = GetFullPathOfFile(fileName); // Create the directory. Directory.CreateDirectory(Directory.GetParent(fullPath).FullName); // Save the file to the server. await using FileStream output = System.IO.File.Create(fullPath); await request.files.CopyToAsync(output); return(Json(new { messege = "Thành công !" })); } else { return(Json(new { messege = "Thất bại!" })); } }
public async Task <IActionResult> GetData(RequestDataModel request) { var categoryModelParamater = new CategoryModelParameter(); var settings = new JsonSerializerSettings(); var searchObject = new CategoryModel { }; settings.DateFormatString = "dd/MM/yyyy"; searchObject = JsonConvert.DeserializeObject <CategoryModel>(request.model, settings); var page = new PageParameter { PageIndex = request.start, PageSize = request.length }; categoryModelParamater.Page = page; categoryModelParamater.Data = searchObject; var hostAPI = "https://localhost:44322"; var data = await ApiProvider.PostAsync <CategoryReturnModel>(hostAPI, ApiConstant.GetAllCategory, categoryModelParamater); return(Json(data)); }
public async Task <IActionResult> GetData(RequestDataModel request) { var grouppageModelParamater = new GroupPageModelParameter(); var settings = new JsonSerializerSettings(); var searchObject = new GroupPageModel { }; settings.DateFormatString = "dd/MM/yyyy"; searchObject = JsonConvert.DeserializeObject <GroupPageModel>(request.model, settings); var page = new PageParameter { PageIndex = request.start, PageSize = request.length }; grouppageModelParamater.Page = page; grouppageModelParamater.Data = searchObject; var hostAPI = url; var data = await ApiProvider.PostAsync <GroupPageReturnModel>(hostAPI, ApiConstant.GetAllGroupPage, grouppageModelParamater); return(Json(data)); }