Exemplo n.º 1
0
        public async Task <string> CreateObjectAsync([FromBody] ObjectViewModel request)
        {
            // HttpRequest res = null;
            var response         = new ListModelResponse <ObjectViewModel>();
            var objectsDataModel = 0;

            try
            {
                objectsDataModel = await _objectRepository.CreateObject(request.ToEntity());

                if (objectsDataModel > 0)
                {
                    response.Message = Messages.SuccessMsg;
                }
                //response.Message = String.Format("Created Project Successfully");

                else
                {
                    //  response.Message = String.Format("Create Project failed");
                    response.Message = Messages.FailMsg;
                }
            }

            catch (Exception ex)
            {
                response.DidError     = true;
                response.ErrorMessage = ex.Message;
            }

            return(response.Message);
        }
Exemplo n.º 2
0
        public async Task <string> UpdateObjectAsync([FromBody] ObjectViewModel request, int objectId)
        {
            //HttpRequest res = null;
            var response          = new ListModelResponse <ObjectViewModel>();
            var projectsDataModel = false;

            try
            {
                projectsDataModel = await _objectRepository.UpdateObject(request.ToEntity(), objectId);

                if (projectsDataModel)
                {
                    //   response.Message = String.Format("Record Updated Successfully");
                    response.Message = Messages.SuccessMsg;
                }
                else
                {
                    //  response.Message = String.Format("Record Updation failed");
                    response.Message = Messages.FailMsg;
                }
            }
            catch (Exception ex)
            {
                response.DidError     = true;
                response.ErrorMessage = ex.Message;
            }

            return(response.Message);
        }