public async Task <ActionResult> SetIndexSections(IndexSectionsModel ism) { try { IndexBoxInfoModel BoxInfo = ((List <IndexBoxInfoModel>)(await _indexboxinforepo.GetAll()).Data).FirstOrDefault(x => x.I_SecId == ism.Section && x.Lang == ism.Lang); if (BoxInfo == null) { await _indexboxinforepo.Insert(new IndexBoxInfoModel() { I_SecId = ism.Section, I_Title = ism.Title, I_Icon = ism.Icon, I_Sort = ism.Sort, Lang = ism.Lang }); await _indexboxinforepo.CommitAllChanges(); } else { await _indexboxinforepo.Update(new IndexBoxInfoModel() { I_Id = BoxInfo.I_Id, I_SecId = ism.Section, I_Title = ism.Title, I_Icon = ism.Icon, I_Sort = ism.Sort, Lang = ism.Lang }); await _indexboxinforepo.CommitAllChanges(); } List <IndexBoxProductRelModel> OldRelations = ((List <IndexBoxProductRelModel>)(await _indexsectionrepo.GetAll()).Data).Where(x => x.I_SecId == ism.Section && x.Lang == ism.Lang).ToList(); foreach (var item in OldRelations) { await _indexsectionrepo.Delete(item); } await _indexsectionrepo.CommitAllChanges(); foreach (int p in ism.Products) { await _indexsectionrepo.Insert(new IndexBoxProductRelModel() { Lang = ism.Lang, I_Pid = p, I_SecId = ism.Section }); } await _indexsectionrepo.CommitAllChanges(); return(new JsonResult(ResponseModel.Success("اطلاعات با موفقیت ذخیره گردید"))); } catch (Exception ex) { return(null); } }
public async Task <IActionResult> UpdateHeaderNotify(HeaderNotificationModel hnm) { try { return(new JsonResult(await _headernotifyrepo.Update(hnm))); } catch (Exception ex) { return(new JsonResult(ResponseModel.ServerInternalError(data: ex))); } }
public async Task <IActionResult> UpdateFaq(FaqModel hnm) { try { return(new JsonResult(await _faqrepo.Update(hnm))); } catch (Exception ex) { return(new JsonResult(ResponseModel.ServerInternalError(data: ex))); } }
public async Task <ActionResult> UpdateService(ServiceModel dp) { try { return(new JsonResult(await _servicerepo.Update(dp))); } catch (Exception ex) { return(null); } }
public async Task <ActionResult> UpdateDepartment(DepartmentModel dp) { try { return(new JsonResult(await _departmentrepo.Update(dp))); } catch (Exception ex) { return(null); } }
public async Task <ActionResult> UpdateOption(OptionsModel om) { try { var option = ((List <OptionsModel>)(await _optionrepo.GetAll()).Data).FirstOrDefault(x => x.O_Key == om.O_Key); if (option == null) { return(new JsonResult(await _optionrepo.Insert(om))); } else { option.O_Value = om.O_Value; return(new JsonResult(await _optionrepo.Update(option))); } } catch (Exception ex) { _logger.LogError("Error in options controller", ex); return(new JsonResult(ResponseModel.Error(data: ex))); } }
public async Task <ActionResult> ChangeStateOfOfflineRequest(OfflineRequestChangeState orcs) { try { var AllReqs = (List <OfflinRequestModel>)(await _offreqrepo.GetAll()).Data; var req = AllReqs.FirstOrDefault(x => x.O_Id == orcs.id); if (req == null) { return(new JsonResult(ResponseModel.Error("درخواست مورد نظر یافت نشد"))); } req.O_Status = orcs.state; req.O_Reason = orcs.reason; req.O_Price = orcs.price; req.O_DeliverDate = orcs.deliver; return(new JsonResult(await _offreqrepo.Update(req))); } catch (Exception ex) { _logger.LogError("Error", ex); return(new JsonResult(ResponseModel.ServerInternalError(data: ex))); } }