public TemplateTabModel GetTemplateTabById(int tabId) { TemplateTabModel tempTab = new TemplateTabModel(); try { var templateTab = _templateTabRepository.GetById(tabId); if (templateTab != null) { tempTab.TemplateID = templateTab.TemplateID; tempTab.TemplateTabID = templateTab.TemplateTabID; tempTab.TemplateTabName = templateTab.TabName; tempTab.Sections = templateTab.Sections; } } catch (EntryPointNotFoundException ex) { string msg = ex.Message; } catch (Exception ex) { string msg = ex.Message; } return(tempTab); }
public bool SetTemplateTab(TemplateTabModel model) { try { if (model.TemplateTabID > 0) { var templateTab = _templateTabRepository.GetById(model.TemplateTabID); if (templateTab != null) { templateTab.TabName = model.TemplateTabName; templateTab.Sections = model.Sections; templateTab.ModifiedOn = DateTime.UtcNow; templateTab.ModifiedBy = 1; _templateTabRepository.Update(templateTab); } } else { var templateTab = new TemplateTab(); templateTab.TemplateID = model.TemplateID; templateTab.TabName = model.TemplateTabName; templateTab.Sections = model.Sections; templateTab.CreatedOn = DateTime.UtcNow; templateTab.CreatedBy = 1; _templateTabRepository.Add(templateTab); } //_templateTabRepository.SaveChangesAsync(); return(true); } catch (EntryPointNotFoundException ex) { return(false); } catch (Exception ex) { return(false); } }