示例#1
0
        public OutPutDTO SaveDomainTypes([FromBody] DomainType obj)
        {
            if (!ModelState.IsValid)
            {
                return(new OutPutDTO(false, Constants.STATUS_CODE.FAILURE, Constants.STATUS_MESSAGE.FAILURE, null));
            }

            try
            {
                DomainType entities = new DomainType();
                if (obj.DomainTypeID != 0)
                {
                    entities = commonBu.Get <DomainType>(obj.DomainTypeID);
                    if (entities != null)
                    {
                        entities.GetTransferData(obj);
                        commonBu.Update(entities);
                        return(new OutPutDTO(true, Constants.STATUS_CODE.SUCCESS, Constants.STATUS_MESSAGE.SUCCESS, entities));
                    }
                    else
                    {
                        return(new OutPutDTO(false, Constants.STATUS_CODE.FAILURE, Constants.STATUS_MESSAGE.FAILURE, null));
                    }
                }
                else
                {
                    commonBu.Save(obj);
                    return(new OutPutDTO(true, Constants.STATUS_CODE.SUCCESS, Constants.STATUS_MESSAGE.SUCCESS, obj));
                }
            }
            catch (Exception ex)
            {
                return(new OutPutDTO(false, Constants.STATUS_CODE.EXCEPTION, Constants.STATUS_MESSAGE.EXCEPTION + ex.Message, null));
            }
        }