Пример #1
0
        public ResultMessage UpdateSupportTeam(SupportTeamV SupportTeam)
        {
            var entity = _domainContext.SUPPORT_TEAM.Find(SupportTeam.Id);

            if (entity == null)
            {
                return new ResultMessage {
                           Id = 0, LastMessage = "Operation Failed! Support Team not found!", OperationSucceed = false
                }
            }
            ;
            entity.Name = SupportTeam.Name;
            _domainContext.Entry(entity).State = System.Data.Entity.EntityState.Modified;
            try
            {
                _domainContext.SaveChanges();

                return(new ResultMessage {
                    Id = entity.Id, LastMessage = "Operation Succeeded!", OperationSucceed = true, ActionLog = "Operation Succeeded!"
                });
            }
            catch (Exception ex)
            {
                return(new ResultMessage {
                    Id = 0, LastMessage = "Operation Failed! please check log", OperationSucceed = false, ActionLog = ex.InnerException != null ? ex.Message + "Inner Exception: " + ex.InnerException.Message : ex.Message
                });
            }
        }
Пример #2
0
        public ResultMessage AddSupportTeam(SupportTeamV SupportTeam)
        {
            var entity = new SUPPORT_TEAM {
                Name = SupportTeam.Name
            };

            _domainContext.SUPPORT_TEAM.Add(entity);
            try
            {
                _domainContext.SaveChanges();
                return(new ResultMessage {
                    Id = entity.Id, LastMessage = "Operation Succeeded!", OperationSucceed = true, ActionLog = "Operation Succeeded!: " + SupportTeam.Name
                });
            }
            catch (Exception ex)
            {
                return(new ResultMessage {
                    Id = 0, LastMessage = "Operation Failed! please check log", OperationSucceed = false, ActionLog = ex.InnerException != null ? ex.Message + "Inner Exception: " + ex.InnerException.Message : ex.Message
                });
            }
        }