示例#1
0
        public async Task <HttpResponseMessage> AddDoorNotes(
            string projectId,
            string templateId,
            string workorderId,
            string workorderDoorId,
            DoorNote note
            )
        {
            string userId = RequestContext.GetUserId();

            var addedNote = await ObjectsLocator.DoorNotesService.AddDoorNote(projectId, templateId, workorderId, workorderDoorId, note, userId);

            return(Request.CreateResponse(HttpStatusCode.OK, addedNote));
        }
示例#2
0
 public DoorNoteViewModel(string doorNo, DoorNote doorNote)
 {
     DoorNo   = doorNo;
     DoorNote = doorNote;
 }
示例#3
0
        public async Task <DoorNote> AddDoorNote(string projectId, string templateId, string workorderId, string doorId, DoorNote note, string userId)
        {
            if (
                projectId != "null" && templateId != "null" && templateId != "null" && workorderId != "null" && doorId != "null" &&
                projectId != "undefined" && templateId != "undefined" && templateId != "undefined" && workorderId != "undefined" && doorId != "undefined" &&
                note != null && userId != null
                )
            {
                note.Timestamp = DateTime.UtcNow;
                note.MbeUserId = userId;

                note.ProjectId   = projectId;
                note.TemplateId  = templateId;
                note.WorkorderId = workorderId;
                note.DoorId      = doorId;

                if (note.Photo != null)
                {
                    note.NoteType = NoteType.PHOTO;
                }
                else if (note.Text != null)
                {
                    note.NoteType = NoteType.TEXT;
                }

                return(await DataUnitOfWork.DoorNoteRepository.CreateDoorNote(note));
            }
            else
            {
                throw new FormatException("Arguments or model not valid");
            }
        }